Skip to content
Snippets Groups Projects
Commit 747bb8c9 authored by Fredrik Hübinette (Hubbe)'s avatar Fredrik Hübinette (Hubbe)
Browse files

more tests added

Rev: src/modules/sprintf/testsuite.in:1.7
Rev: src/testsuite.in:1.5
parent 7e4f2d3b
No related branches found
No related tags found
No related merge requests found
...@@ -48,8 +48,12 @@ test_eq(sprintf("%'FOO'10s","BAR"),"FOOFOOFBAR") ...@@ -48,8 +48,12 @@ test_eq(sprintf("%'FOO'10s","BAR"),"FOOFOOFBAR")
test_eq(sprintf("%d %<d %<d",2),"2 2 2") 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"}))))
test_true(stringp(sprintf("%O",([1:2,"foo":"bar"])))) 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 \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
dnl ^, @ and _ hasn't been tested yet dnl ^, @ and _ hasn't been tested yet
......
...@@ -40,14 +40,6 @@ cond([[all_efuns()->localtime]], ...@@ -40,14 +40,6 @@ cond([[all_efuns()->localtime]],
test_true(mappingp(localtime(0))) test_true(mappingp(localtime(0)))
]]) ]])
// strerror
cond([[all_efuns()->strerror]],
[[
test_do(strerror(1))
test_true(stringp(strerror(2)||""))
]])
// sort // sort
test_equal(sort(({1,3,2,4})),({1,2,3,4})) test_equal(sort(({1,3,2,4})),({1,2,3,4}))
test_equal(sort(({4,3,2,1})),({1,2,3,4})) test_equal(sort(({4,3,2,1})),({1,2,3,4}))
...@@ -78,6 +70,23 @@ return 0; ...@@ -78,6 +70,23 @@ return 0;
test_true(objectp(clone(Queue))) 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([[ test_any([[
#include <string.h> #include <string.h>
return 0; return 0;
...@@ -90,6 +99,8 @@ return 0; ...@@ -90,6 +99,8 @@ return 0;
test_eq((string)Flurp,"testtest") test_eq((string)Flurp,"testtest")
test_do(add_constant("Flurp")) test_do(add_constant("Flurp"))
test_eq(strmult("foo",4),"foofoofoofoo")
// m_delete // m_delete
test_equal(([1:1]),m_delete(a(),0)) test_equal(([1:1]),m_delete(a(),0))
test_equal(([1:1]),m_delete(([1:1,0:3]),0)) test_equal(([1:1]),m_delete(([1:1,0:3]),0))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment