summaryrefslogtreecommitdiff
path: root/lab_6/unity/test/tests
diff options
context:
space:
mode:
Diffstat (limited to 'lab_6/unity/test/tests')
-rw-r--r--lab_6/unity/test/tests/Testfoo.c18
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);
+ }
}