Example #1
0
#include "CppUTest/TestHarness.h"
#include "CppUTest/TestRegistry.h"
#include "CppUTest/TestOutput.h"
#include "CppUTest/TestTestingFixture.h"
#include "CppUTest/PlatformSpecificFunctions.h"


extern "C" int setup_teardown_was_called_in_test_group_in_C;
extern "C" int test_was_called_in_test_group_in_C;
int setup_teardown_was_called_in_test_group_in_C = 0;
int test_was_called_in_test_group_in_C = 0;

TEST_GROUP_C(TestGroupInC)
{
    TEST_GROUP_C_SETUP_WRAPPER(TestGroupInC)
    TEST_GROUP_C_TEARDOWN_WRAPPER(TestGroupInC)
};

TEST_GROUP_C_WRAPPER(TestGroupInC, checkThatTheTestHasRun)

/*
 * This test is a bit strange. They use the fact that you can do -r2 for repeating the same run.
 * When you do so, the same statics will be shared and therefore we can test whether the setup/teardown is run
 * correctly.
 */

TEST(TestGroupInC, setupHasBeenCalled)
{
    test_was_called_in_test_group_in_C++;
    /* Increased in setup, decreased in teardown. So at this point it must be 1 also on a multiple run */
Example #2
0
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

#include <CppUTest/CommandLineTestRunner.h>
#include <CppUTest/TestHarness_c.h>


TEST_GROUP_C(JobsTypesTests) {
  TEST_GROUP_C_SETUP_WRAPPER(JobsTypesTests)
  TEST_GROUP_C_TEARDOWN_WRAPPER(JobsTypesTests)
};

TEST_GROUP_C_WRAPPER(JobsTypesTests, StringToStatus)
TEST_GROUP_C_WRAPPER(JobsTypesTests, StatusToString)

TEST_GROUP_C(JobsJsonTests) {
  TEST_GROUP_C_SETUP_WRAPPER(JobsJsonTests)
  TEST_GROUP_C_TEARDOWN_WRAPPER(JobsJsonTests)
};

TEST_GROUP_C_WRAPPER(JobsJsonTests, SerializeUpdateRequest)
TEST_GROUP_C_WRAPPER(JobsJsonTests, SerializeUpdateRequestWithNullBuffer)
TEST_GROUP_C_WRAPPER(JobsJsonTests, SerializeUpdateRequestWithTooSmallBuffer)
TEST_GROUP_C_WRAPPER(JobsJsonTests, SerializeDescribeJobExecutionRequest)