1 changed files with 72 additions and 0 deletions
@ -0,0 +1,72 @@ |
|||
#include "CppUTest/TestHarness.h"
|
|||
#include "CppUTest/TestRegistry.h"
|
|||
#include "CppUTest/TestOutput.h"
|
|||
#include "CppUTest/TestTestingFixture.h"
|
|||
|
|||
#include "vec.h"
|
|||
|
|||
#define TESTSIZE 4
|
|||
|
|||
TEST_GROUP(Vector) |
|||
{ |
|||
void setup() |
|||
{ |
|||
} |
|||
|
|||
void teardown() |
|||
{ |
|||
} |
|||
}; |
|||
TEST(Vector, set) |
|||
{ |
|||
Vec<int,TESTSIZE> a ; |
|||
Vec<int,TESTSIZE> b ; |
|||
|
|||
for (int x = 0; x <TESTSIZE ; ++x) |
|||
{ |
|||
int val = x+1; |
|||
a(x) = val; |
|||
CHECK_EQUAL(val,a(x)); |
|||
} |
|||
|
|||
for (int x = 0; x <TESTSIZE ; ++x) |
|||
{ |
|||
CHECK_EQUAL(0,b(x)); |
|||
} |
|||
b = a; |
|||
for (int x = 0; x <TESTSIZE ; ++x) |
|||
{ |
|||
int val = (x+1); |
|||
CHECK_EQUAL(val,b(x)); |
|||
} |
|||
} |
|||
TEST(Vector, init_set) |
|||
{ |
|||
Vec<int,TESTSIZE> a ; |
|||
|
|||
for (int x = 0; x <TESTSIZE ; ++x) |
|||
{ |
|||
int val = (x+1); |
|||
a(x) = val; |
|||
} |
|||
for (int x = 0; x <TESTSIZE ; x++) |
|||
{ |
|||
int val = (x+1); |
|||
CHECK_EQUAL(val,a(x)); |
|||
} |
|||
|
|||
Vec<int, TESTSIZE> b = a; |
|||
for (int x = 0; x <TESTSIZE ; x++) |
|||
{ |
|||
int val = (x+1); |
|||
CHECK_EQUAL(val,b(x)); |
|||
} |
|||
} |
|||
TEST(Vector, init) |
|||
{ |
|||
Vec<int,TESTSIZE> a ; |
|||
for (int x = 0; x <TESTSIZE ; x++) |
|||
{ |
|||
CHECK_EQUAL(0 , a(x) ); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue