/usr/share/lifelines/st/st_table.li is in lifelines-reports 3.0.61-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | /*
* @progname st_table.li
* @version 1.0 (2005-02-01)
* @author Perry Rapp
* @category self-test
* @output none
* @description validate table functions
*/
char_encoding("ASCII")
require("lifelines-reports.version:1.3")
option("explicitvars") /* Disallow use of undefined variables */
include("st_aux")
/* entry point in case not invoked via st_all.ll */
proc main()
{
call testTables()
}
/*
test some table functions
*/
proc testTables()
{
call initSubsection()
table(tbl)
/* empty table tests */
if (not(empty(tbl))) {
call reportfail("empty FAILED")
}
else { incr(testok) }
if (ne(length(tbl), 0)) {
call reportfail("length(table)==0 FAILED")
}
else { incr(testok) }
/* single element table tests */
insert(tbl, "alpha", 1)
if (empty(tbl)) {
call reportfail("not empty FAILED")
}
else { incr(testok) }
set(el, lookup(tbl, "alpha"))
if (ne(el, 1)) {
call reportfail("lookup(alpha) FAILED")
}
else { incr(testok) }
if (ne(length(tbl), 1)) {
call reportfail("length(table)==1 FAILED")
}
else { incr(testok) }
insert(tbl, "alpha", 2)
set(el, lookup(tbl, "alpha"))
if (ne(el, 2)) {
call reportfail("lookup(alpha) FAILED")
}
else { incr(testok) }
if (ne(length(tbl), 1)) {
call reportfail("length(table)==1 FAILED")
}
else { incr(testok) }
/* two element table tests */
insert(tbl, "bravo", 2)
if (ne(length(tbl), 2)) {
call reportfail("length(table)==2 FAILED")
}
else { incr(testok) }
call testFreeTable(tbl)
call reportSubsection("table tests")
}
proc testFreeTable(tbl)
{
free(tbl)
if (ne(tbl, 0)) {
call reportfail("free table FAILED")
}
else { incr(testok) }
}
|