diff --git a/src/modules/sprintf/testsuite.in b/src/modules/sprintf/testsuite.in index 677322b3be665ef4ac07fb58ff3fc468acf37634..db14290640fd2a69160e93ffd3a79ed2519b331b 100644 --- a/src/modules/sprintf/testsuite.in +++ b/src/modules/sprintf/testsuite.in @@ -48,8 +48,12 @@ test_eq(sprintf("%'FOO'10s","BAR"),"FOOFOOFBAR") test_eq(sprintf("%d %<d %<d",2),"2 2 2") test_true(stringp(sprintf("%O",({1,2,"foo"})))) test_true(stringp(sprintf("%O",([1:2,"foo":"bar"])))) +test_eq(strlen(sprintf("%@c",allocate(1000))),1000) test_eq(sprintf("test \0 \n"),"test \0 \n") +test_eq(sprintf("test \0"),"test \0") +test_eq(sprintf("%~*n","f",5),"fffff") +test_eq(sprintf("%'\000'*n",5),"\000\000\000\000\000") dnl . : and ; hasn't been tested dnl ^, @ and _ hasn't been tested yet diff --git a/src/testsuite.in b/src/testsuite.in index 1d9d029b8248f8379f55330051737d738f5bb975..a2e3410a33921bfff3a1e3545e27b462fe49a6f7 100644 --- a/src/testsuite.in +++ b/src/testsuite.in @@ -40,14 +40,6 @@ cond([[all_efuns()->localtime]], test_true(mappingp(localtime(0))) ]]) -// strerror -cond([[all_efuns()->strerror]], -[[ -test_do(strerror(1)) -test_true(stringp(strerror(2)||"")) -]]) - - // sort test_equal(sort(({1,3,2,4})),({1,2,3,4})) test_equal(sort(({4,3,2,1})),({1,2,3,4})) @@ -78,6 +70,23 @@ return 0; test_true(objectp(clone(Queue))) ]]) +test_any([[ +#include <getopt.h> +return 0; +]],0) + + test_true(find_option(({"","--foo"}),"p","foo")) + test_eq(find_option(({"","--foo=bar"}),"p","foo",0,0),"bar") + test_eq(find_option(({"","--foo","bar"}),"p","foo",0,0),"bar") + test_eq(find_option(({"","--","--foo=bar"}),"p","foo",0,0),0) + + test_true(find_option(({"","-p"}),"p","foo")) + test_eq(find_option(({"","-pbar"}),"p","foo",0,0),"bar") + test_eq(find_option(({"","-p","bar"}),"p","foo",0,0),"bar") + test_eq(find_option(({"","--","--p","bar"}),"p","foo",0,0),0) + + test_equal(get_args(({"",0,0,"sune","--","-foo"})),({"","sune","-foo"})) + test_any([[ #include <string.h> return 0; @@ -90,6 +99,8 @@ return 0; test_eq((string)Flurp,"testtest") test_do(add_constant("Flurp")) + test_eq(strmult("foo",4),"foofoofoofoo") + // m_delete test_equal(([1:1]),m_delete(a(),0)) test_equal(([1:1]),m_delete(([1:1,0:3]),0))