itoa unit test, not a very detailed one

This commit is contained in:
rusefillc 2022-01-03 03:31:57 -05:00
parent 2ec7fe2f97
commit 5737590d94
3 changed files with 7 additions and 1 deletions

View File

@ -193,7 +193,6 @@ static char* itoa_signed(char *p, int num, unsigned radix) {
* @return pointer at the end zero symbol after the digits
*/
char* itoa10(char *p, int num) {
// todo: unit test
return itoa_signed(p, num, 10);
}

View File

@ -74,6 +74,7 @@ int maxI(int i1, int i2);
int minI(int i1, int i2);
float maxF(float i1, float i2);
float minF(float i1, float i2);
// sometimes known as 'itoa'
char* itoa10(char *p, int num);
bool isSameF(float v1, float v2);

View File

@ -21,6 +21,12 @@
#include "crc.h"
#include "fl_stack.h"
TEST(util, testitoa) {
char buffer[12];
itoa10(buffer, 239);
ASSERT_TRUE(strEqual(buffer, "239"));
}
TEST(util, negativeZero) {
ASSERT_TRUE(IS_NEGATIVE_ZERO(-0.0));