-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathdisabledtest.cpp
95 lines (81 loc) · 2.37 KB
/
disabledtest.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//======================================================================
//-----------------------------------------------------------------------
/**
* @file disabledtest.cpp
* @brief disabled test sample
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2014-2020, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
//-----------------------------------------------------------------------
//======================================================================
#include "../include/iutest.hpp"
/* ---------------------------------------------------
* Diabled Test
*//*--------------------------------------------------*/
IUTEST(TestDisabled, DISABLED_Test1)
{
// disable
IUTEST_ASSERT_TRUE(false);
}
IUTEST(TestDisabled, Test2)
{
// enable
IUTEST_ASSERT_TRUE(true);
}
IUTEST(DISABLED_TestCaseDisabled, Test1)
{
// disable
IUTEST_ASSERT_TRUE(false);
}
IUTEST(DISABLED_TestCaseDisabled, Test2)
{
// disable
IUTEST_ASSERT_TRUE(false);
}
// DISABLED Test Tips.
#define DISABLED_MacroTest EnabledTest
#define MacroTest DISABLED_Test
IUTEST(DISABLED_MacroTest, Enable)
{
IUTEST_ASSERT_EQ(0, 0);
}
IUTEST(EnabledTest, Count)
{
const ::iutest::TestCase* testcase = ::iuutil::GetCurrentTestSuite();
IUTEST_ASSERT_NOTNULL(testcase);
IUTEST_ASSERT_EQ(2, testcase->total_test_count());
IUTEST_ASSERT_EQ(2, testcase->test_to_run_count());
IUTEST_ASSERT_EQ(0, testcase->disabled_test_count());
IUTEST_ASSERT_TRUE(testcase->Passed());
IUTEST_ASSERT_FALSE(testcase->Failed());
}
IUTEST(MacroTest, NotRun)
{
IUTEST_ASSERT_EQ(2, 3);
}
class EnabledTestFixed : public ::iutest::Test {};
typedef EnabledTestFixed DISABLED_TestFixed;
#define MacroTestF DISABLED_TestFixed
#define DISABLED_MacroTestF EnabledTestFixed
IUTEST_F(MacroTestF, NotRun)
{
IUTEST_ASSERT_EQ(2, 3);
}
IUTEST_F(DISABLED_MacroTestF, Run)
{
IUTEST_ASSERT_EQ(0, 0);
}
IUTEST_F(EnabledTestFixed, Count)
{
const ::iutest::TestCase* testcase = ::iuutil::GetCurrentTestSuite();
IUTEST_ASSERT_NOTNULL(testcase);
IUTEST_ASSERT_EQ(2, testcase->total_test_count());
IUTEST_ASSERT_EQ(2, testcase->test_to_run_count());
IUTEST_ASSERT_EQ(0, testcase->disabled_test_count());
IUTEST_ASSERT_TRUE(testcase->Passed());
IUTEST_ASSERT_FALSE(testcase->Failed());
}