Mercurial > printf
diff test.c @ 0:e3088565a6b8 default tip
*: initial commit
kinda dumb, but wifi was out and I was bored.
most of this code is shit.
| author | Paper <paper@tflc.us> |
|---|---|
| date | Wed, 03 Dec 2025 03:04:39 -0500 |
| parents | |
| children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test.c Wed Dec 03 03:04:39 2025 -0500 @@ -0,0 +1,40 @@ +#include "printf.h" + +#include <locale.h> +#include <stdlib.h> /* malloc */ +#include <limits.h> +#include <stdint.h> +#include <float.h> + +int test_fprintf(void); +int test_asprintf(void); +int test_snprintf(void); + +int main(void) +{ + /* :p */ + setlocale(LC_ALL, "C.UTF-8"); + + if (test_asprintf() != 0) { + fprintf(stderr, "asprintf test failed!\n"); + return 1; + } + + if (test_snprintf() != 0) { + fprintf(stderr, "snprintf test failed!\n"); + return 1; + } + + if (test_fprintf() != 0) { + fprintf(stderr, "fprintf test failed!\n"); + return 1; + } + + /* print this too... */ + my_printf( +#include "test.h" + ); + + printf("All tests succeeded.\n"); + return 0; +} \ No newline at end of file
