blob: 1f07d75f3962a075f40fcb6cf8c5c7a09b36bad4 [file] [log] [blame]
// Part of the Crubit project, under the Apache License v2.0 with LLVM
// Exceptions. See /LICENSE for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#include <utility>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "cc_bindings_from_rs/test/impls/impls_cc_api.h"
namespace crubit {
namespace {
TEST(ImplsTest, BasicStaticMethod) {
std::int32_t sum = impls::basic_static_method::Math::add_i32(123, 456);
EXPECT_EQ(sum, 123 + 456);
}
TEST(ImplsTest, StaticMethodTakingSameStructByValue) {
namespace test = impls::static_method_taking_same_struct_by_value;
test::Number x = test::Number::create(123);
EXPECT_EQ(123, test::Number::static_into_i32(std::move(x)));
}
TEST(ImplsTest, NonContiguousMethodDeclsAndDefs) {
namespace test = impls::non_contiguous_method_decls_and_defs;
EXPECT_EQ(123 + 456, test::S1::add_structs(test::S1::create(123),
test::S2::create(456)));
EXPECT_EQ(123 + 456, test::S2::add_structs(test::S1::create(123),
test::S2::create(456)));
}
} // namespace
} // namespace crubit