xtd 0.2.0
Loading...
Searching...
No Matches
gtest.hpp
1
2
6#pragma once
7#include "xtd.tunit.hpp"
8
9#if !defined(__XTD_EXPERIMENTAL_GTEST_HELPERS__)
10#error "Do not use this file: it is for experimental purposes only"
11#endif
12
13namespace testing {
14 void InitGoogleTest() {xtd::tunit::settings::default_settings().gtest_compatibility(true);}
15 void InitGoogleTest(int argc, char* argv[]) {InitGoogleTest();}
16}
17
18#define ASSERT_EQ(val1, val2) xtd::tunit::assert::are_equal(val1, val2)
19#define ASSERT_NE(val1, val2) xtd::tunit::assert::are_not_equal(val1, val2)
20#define ASSERT_FALSE(condition) xtd::tunit::assert::is_false(condition)
21#define ASSERT_TRUE(condition) xtd::tunit::assert::is_true(condition)
22
23#define EXPECT_FALSE(condition) xtd::tunit::assume::is_false(condition)
24#define EXPECT_TRUE(condition) xtd::tunit::assume::is_true(condition)
25
26#define RUN_ALL_TESTS xtd::tunit::console_unit_test().run
27
28#define TEST(class_name, method_name) \
29 void __##class_name##method_name(); \
30 class __class_##class_name##_##method_name; \
31 xtd::tunit::test_class_attribute<__class_##class_name##_##method_name> __class_##class_name##_##method_name##_attr {typeof_<__class_##class_name##_##method_name>().full_name().replace(typeof_<__class_##class_name##_##method_name>().name(), xtd::string::empty_string) + #class_name}; \
32 class __class_##class_name##_##method_name : public xtd::tunit::test_class { \
33 xtd::tunit::test_method_attribute __class_##class_name##_##method_name##_method {#method_name, *this, &__class_##class_name##_##method_name::__method}; \
34 void __method() { \
35 if (xtd::string {#method_name}.starts_with("DISABLED_")) xtd::tunit::assert::ignore();\
36 __##class_name##method_name(); \
37 } \
38 }; \
39 void __##class_name##method_name()
40
static xtd::tunit::settings & default_settings() noexcept
Gets default settings instance.
bool gtest_compatibility() const noexcept
Gets google test comaptibility.
Contains xtd.tunit library headers.