diff options
| author | Fuwn <[email protected]> | 2026-02-26 10:45:56 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-26 10:45:56 -0800 |
| commit | c0c5237849fb7a647de82c590c34d71239f948a4 (patch) | |
| tree | 9d72a3b19b0635fd3953b77d87037d8b64a84b92 /lab_6/unity/test/tests | |
| parent | fix(lab_6): default Unity rake target to gcc_64 (diff) | |
| download | cst456-main.tar.xz cst456-main.zip | |
Diffstat (limited to 'lab_6/unity/test/tests')
| -rw-r--r-- | lab_6/unity/test/tests/Testfoo.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/lab_6/unity/test/tests/Testfoo.c b/lab_6/unity/test/tests/Testfoo.c index eac2bee..433dc4e 100644 --- a/lab_6/unity/test/tests/Testfoo.c +++ b/lab_6/unity/test/tests/Testfoo.c @@ -28,6 +28,8 @@ void testTEST_ASSERT_FALSE (void) void testTEST_ASSERT_EQUAL_INT8 (void)
{
TEST_ASSERT_EQUAL_INT8( 1, 1);
+ TEST_ASSERT_EQUAL_INT8(-5, -5);
+ TEST_ASSERT_EQUAL_INT8(0x7f, 127);
//TEST_ASSERT_EQUAL_INT8(-1, 1); //failing
}
@@ -36,6 +38,8 @@ void testTEST_ASSERT_EQUAL_INT8 (void) void testTEST_ASSERT_EQUAL_UINT8 (void)
{
TEST_ASSERT_EQUAL_UINT8(1, 1);
+ TEST_ASSERT_EQUAL_UINT8(255, 255);
+ TEST_ASSERT_EQUAL_UINT8(0xa5, 165);
//TEST_ASSERT_EQUAL_UINT8(1, -1); //failing
}
@@ -44,6 +48,8 @@ void testTEST_ASSERT_EQUAL_UINT8 (void) void testTEST_ASSERT_EQUAL_HEX8 (void)
{
TEST_ASSERT_EQUAL_HEX8( 0xff, 0xff );
+ TEST_ASSERT_EQUAL_HEX8( 0x00, 0x00 );
+ TEST_ASSERT_EQUAL_HEX8( 0x7f, 0x7f );
//TEST_ASSERT_EQUAL_HEX8( 0x00, 0xff ); //failing
}
@@ -80,5 +86,15 @@ void testTEST_ASSERT_BIT_HIGH (void) // unsigned integer.
void testsquareNumber (void)
{
-
+ uint16_t input;
+ uint16_t expected;
+ uint16_t actual;
+
+ for (input = 0; input <= 255; input++)
+ {
+ expected = input * input;
+ actual = squareNumber((uint8_t) input);
+
+ TEST_ASSERT_EQUAL_UINT16(expected, actual);
+ }
}
|