Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: f69abb441112fd74fadbb8594403bb468ae569e0 (plain) (blame)
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
/*******************************************************************************
 * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * CONTRIBUTORS:
 * 		Thomas Schuetz (initial contribution)
 *
 *******************************************************************************/


/*
 * TestEtUnit.c
 *
 *  Created on: 16.01.2012
 *      Author: tschuetz
 */

#include "TestEtUnit.h"
#include "etUnit/etUnit.h"

void TestEtUnit_Expect(void){
	EXPECT_TRUE("EXPECT_TRUE", TRUE);
	EXPECT_FALSE("EXPECT_FALSE", FALSE);

	/* signed integer values */
	EXPECT_EQUAL_INT8("EXPECT_EQUAL_INT8", -123, -123);
	EXPECT_EQUAL_INT16("EXPECT_EQUAL_INT16", -12345, -12345);
	EXPECT_EQUAL_INT32("EXPECT_EQUAL_INT32", -1234567, -1234567);

	/* unsigned integer values */
	EXPECT_EQUAL_UINT8("EXPECT_EQUAL_INT8", 123, 123);
	EXPECT_EQUAL_UINT16("EXPECT_EQUAL_INT16", 12345, 12345);
	EXPECT_EQUAL_UINT32("EXPECT_EQUAL_INT32", 1234567, 1234567);

	/* float values */
	EXPECT_EQUAL_FLOAT32("EXPECT_EQUAL_FLOAT32", (etFloat32) 123.456, (etFloat32) 123.456, (etFloat32) 0.0001);
	EXPECT_EQUAL_FLOAT32("EXPECT_EQUAL_FLOAT32", (etFloat32) 123.456, (etFloat32) 123.456, (etFloat32) 0.0001);

	/* Pointers */
	etUInt16 value;
	etUInt16* valuePtr = &value;

	EXPECT_EQUAL_PTR("EXPECT_EQUAL_PTR", &value, valuePtr) \

}


void TestEtUnit_Expect_Order(void){
	etInt16 list[] = {1,2,3,4};
	EXPECT_ORDER_START(list, 4);
	EXPECT_ORDER("id=1", 1);
	EXPECT_ORDER("id=2", 2);
	EXPECT_ORDER("id=3", 3);
	EXPECT_ORDER_END("id=4", 4);
}

void TestEtUnit_runSuite(void){
	etUnit_openTestSuite("TestEtUnit");
	ADD_TESTCASE(TestEtUnit_Expect_Order);
	ADD_TESTCASE(TestEtUnit_Expect);
	etUnit_closeTestSuite();
}


Back to the top