|
// Written by retoor@molodetz.nl
|
|
|
|
// This program tests the functionality of converting milliseconds into a readable format using assertions to verify correct output, using
|
|
// an assumed custom testing and time conversion library.
|
|
|
|
// The source code uses the custom includes "rtime.h" for time conversion and "rtest.h" for testing framework functionalities.
|
|
|
|
// MIT License
|
|
|
|
#include "rtime.h"
|
|
#include "rtest.h"
|
|
#include <string.h>
|
|
|
|
int main() {
|
|
rtest_banner("time");
|
|
rtest_banner("Milliseconds tests");
|
|
rtest_assert(strcmp(msecs_str(0), "0Ms") == 0);
|
|
rtest_assert(strcmp(msecs_str(1), "1Ms") == 0);
|
|
rtest_assert(strcmp(msecs_str(12), "12Ms") == 0);
|
|
rtest_assert(strcmp(msecs_str(123), "123Ms") == 0);
|
|
rtest_assert(strcmp(msecs_str(999), "999Ms") == 0);
|
|
rtest_banner("Second tests");
|
|
rtest_assert(strcmp(msecs_str(1000), "1s") == 0);
|
|
rtest_assert(strcmp(msecs_str(1100), "1.1s") == 0);
|
|
rtest_assert(strcmp(msecs_str(1234), "1.234s") == 0);
|
|
rtest_assert(strcmp(msecs_str(12345), "12.345s") == 0);
|
|
return rtest_end("success");
|
|
} |