Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cpputest/tests/CppUTest/CheatSheetTest.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (28 sloc)
787 Bytes
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
static void (*real_one) (); | |
static void stub(){} | |
/* in CheatSheetTest.cpp */ | |
#include "CppUTest/TestHarness.h" | |
/* Declare TestGroup with name CheatSheet */ | |
TEST_GROUP(CheatSheet) | |
{ | |
/* declare a setup method for the test group. Optional. */ | |
void setup() _override | |
{ | |
/* Set method real_one to stub. Automatically restore in teardown */ | |
UT_PTR_SET(real_one, stub); | |
} | |
/* Declare a teardown method for the test group. Optional */ | |
void teardown() _override | |
{ | |
} | |
}; /* Do not forget semicolumn */ | |
/* Declare one test within the test group */ | |
TEST(CheatSheet, TestName) | |
{ | |
/* Check two longs are equal */ | |
LONGS_EQUAL(1, 1); | |
/* Check a condition */ | |
CHECK(true == true); | |
/* Check a string */ | |
STRCMP_EQUAL("HelloWorld", "HelloWorld"); | |
} |