You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
907 B

  1. #include "unity.h"
  2. #include "conversionOfNumbers.h"
  3. void setUp(){}
  4. void tearDown(){}
  5. void test_convert2ToBinaryStr10(){
  6. //arrange
  7. char* result;
  8. char expected[] = "10";
  9. //act
  10. result = convertIntToBinaryStr(2);
  11. //assert
  12. TEST_ASSERT_EQUAL_STRING(expected, result);
  13. }
  14. void test_binaryStringLengthOfInput5is3(){
  15. //arrange
  16. int result;
  17. int expected = 3;
  18. //act
  19. result = binaryStrLen(5);
  20. //assert
  21. TEST_ASSERT_EQUAL_INT(expected, result);
  22. }
  23. void test_binaryStringLengthOfInput0is1(){
  24. //arrange
  25. int result;
  26. int expected = 1;
  27. //act
  28. result = binaryStrLen(0);
  29. //assert
  30. TEST_ASSERT_EQUAL_INT(expected, result);
  31. }
  32. void test_convert10ToBinaryStr1010(){
  33. //arrange
  34. char* result;
  35. char expected[] = "1010";
  36. //act
  37. result = convertIntToBinaryStr(10);
  38. //assert
  39. TEST_ASSERT_EQUAL_STRING(expected, result);
  40. }