Debian Codegraph @

tests/CppUTest/CheatSheetTest.cpp

raw
1
2 static void (*real_one) ();
3 static void stub(){}
4
5 /* in CheatSheetTest.cpp */
6 #include "CppUTest/TestHarness.h"
7
8 /* Declare TestGroup with name CheatSheet */
9 TEST_GROUP(CheatSheet)
10 {
11 /* declare a setup method for the test group. Optional. */
12 void setup ()
13 {
14 /* Set method real_one to stub. Automatically restore in teardown */
15 UT_PTR_SET(real_one, stub);
16 }
17
18 /* Declare a teardown method for the test group. Optional */
19 void teardown()
20 {
21 }
22 }; /* Do not forget semicolumn */
23
24 /* Declare one test within the test group */
25 TEST(CheatSheet, TestName)
26 {
27 /* Check two longs are equal */
28 LONGS_EQUAL(1, 1);
29
30 /* Check a condition */
31 CHECK(true == true);
32
33 /* Check a string */
34 STRCMP_EQUAL("HelloWorld", "HelloWorld");
35 }
36