#include "../fixedptc.h" #include "test_utils.h" #include #include #include int assert_string_value(char *filename, double value) { fpt v = fpt_rconst(value); char *_v = fptoa(v); dbg("to_string %f = %s", value, _v); assert_snapshot(filename, _v); return 0; } #define test_str(value) \ assert(assert_string_value(__FILE_NAME__ "_" #value ".snapshot", value) == 0) int main(void) { test_str(0.25); test_str(0.125); test_str(0.3125); test_str(-785); print_success; }