From 4e49e2cca731f2e1dd01ebc5163beb71e0d640ec Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 17 Aug 2015 23:23:29 -0500 Subject: Test for human_readable() --- toys/example/test_human_readable.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 toys/example/test_human_readable.c (limited to 'toys/example') diff --git a/toys/example/test_human_readable.c b/toys/example/test_human_readable.c new file mode 100644 index 00000000..ae8e7888 --- /dev/null +++ b/toys/example/test_human_readable.c @@ -0,0 +1,23 @@ +/* test_human_readable.c - Expose lib/lib.c human_readable() for testing. + * + * Copyright 2015 Rob Landley + +USE_TEST_HUMAN_READABLE(NEWTOY(test_human_readable, "<1>1ibs", 0)) + +config TEST_HUMAN_READABLE + bool "test_human_readable" + default n + help + usage: test_human_readable [-sbi] NUMBER +*/ + +#define FOR_test_human_readable +#include "toys.h" + +void test_human_readable_main(void) +{ + char *c; + + human_readable(toybuf, strtoll(*toys.optargs, &c, 0), toys.optflags); + printf("%s\n", toybuf); +} -- cgit v1.2.3