Jamoma API  0.6.0.a19
TTList.test.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup foundationLibrary
4  *
5  * @brief #TTListTest is an class used for unit tests of the #TTList class.
6  *
7  * @details
8  *
9  * @author Théo de la Hogue, Tim Place
10  *
11  * @copyright Copyright © 2013, Théo de la Hogue, Tim Place @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 #include "TTList.test.h"
17 
18 #define thisTTClass TTListTest
19 #define thisTTClassName "list.test"
20 #define thisTTClassTags "test, foundation"
21 
22 
24 {;}
25 
26 
27 TTListTest::~TTListTest()
28 {;}
29 
30 
31 void TTListTestBasic(int& errorCount, int& testAssertionCount)
32 {
33  TTTestLog("\n");
34  TTTestLog("Testing list basic operations");
35 
36  TTTestLog("\n");
37  TTTestLog("Testing list creation");
38 
39  // creation
40  TTList l1;
41 
42  TTTestAssertion("TTList size : Test fails if the list can't report its size or the fact it is empty",
43  l1.getSize() == 0 && l1.isEmpty(),
44  testAssertionCount,
45  errorCount);
46 
47  // iteration on an empty list
48  TTUInt8 i = 0;
49  for (l1.begin(); l1.end(); l1.next())
50  i++;
51 
52  TTTestAssertion("TTList iteration on empty : Test fails if the list have made an iteration",
53  i == 0,
54  testAssertionCount,
55  errorCount);
56 }
57 
58 TTErr TTListTest::test(TTValue& returnedTestInfo)
59 {
60  int errorCount = 0;
61  int testAssertionCount = 0;
62 
63  TTListTestBasic(errorCount, testAssertionCount);
64 
65  return TTTestFinish(testAssertionCount, errorCount, returnedTestInfo);
66 }
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
TTListTest is an class used for unit tests of the #TTList class.
TT_OBJECT_CONSTRUCTOR
Constructor macro.
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34
unsigned char TTUInt8
8 bit unsigned integer (char)
Definition: TTBase.h:174