-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
51d8542
commit 4500091
Showing
3 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#pragma once | ||
#include "gtest.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/// @file | ||
/// @brief Contains gtest helpers. | ||
/// @copyright Copyright (c) 2024 Gammasoft. All rights reserved. | ||
#pragma once | ||
#include "xtd.tunit.h" | ||
|
||
/// @cond | ||
|
||
namespace testing { | ||
void InitGoogleTest() {xtd::tunit::settings::default_settings().gtest_compatibility(true);} | ||
void InitGoogleTest(int argc, char* argv[]) {InitGoogleTest();} | ||
} | ||
|
||
#define ASSERT_FALSE(condition) xtd::tunit::assert::is_false(condition, csf_) | ||
#define ASSERT_TRUE(condition) xtd::tunit::assert::is_true(condition, csf_) | ||
|
||
#define EXPECT_FALSE(condition) xtd::tunit::valid::is_false(condition, csf_) | ||
#define EXPECT_TRUE(condition) xtd::tunit::valid::is_true(condition, csf_) | ||
|
||
#define RUN_ALL_TESTS xtd::tunit::console_unit_test().run | ||
|
||
#define TEST(class_name, method_name) \ | ||
void __##class_name##method_name(); \ | ||
class __class_##class_name##_##method_name; \ | ||
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(), "") + #class_name}; \ | ||
class __class_##class_name##_##method_name : public xtd::tunit::test_class { \ | ||
xtd::tunit::test_method_attribute __class_##class_name##_##method_name##_method {#method_name, *this, &__class_##class_name##_##method_name::__method}; \ | ||
void __method() { \ | ||
if (xtd::ustring {#method_name}.starts_with("DISABLED_")) xtd::tunit::assert::ignore();\ | ||
__##class_name##method_name(); \ | ||
} \ | ||
}; \ | ||
void __##class_name##method_name() | ||
|
||
/// @endcond |