Files
gotta-scroll-fast/driver/tests/fp_to_str.test.c
T
thomas 5f1254d11a
Tests / test_core_function (push) Failing after 12s
import upstream maccel baseline
2026-03-25 09:32:22 +00:00

28 lines
587 B
C

#include "../fixedptc.h"
#include "test_utils.h"
#include <assert.h>
#include <linux/limits.h>
#include <unistd.h>
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;
}