OKlibrary  0.2.1.6
Strings.mac
Go to the documentation of this file.
00001 /* Oliver Kullmann, 30.10.2011 (Swansea) */
00002 /* Copyright 2011 Oliver Kullmann
00003 This file is part of the OKlibrary. OKlibrary is free software; you can redistribute
00004 it and/or modify it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation and included in this library; either version 3 of the
00006 License, or any later version. */
00007 
00022 oklib_include("OKlib/ComputerAlgebra/TestSystem/Lisp/Asserts.mac")$
00023 oklib_include("OKlib/ComputerAlgebra/DataStructures/Lisp/Strings.mac");
00024 
00025 kill(f)$
00026 
00027 
00028 okltest_print_nlb(f) := block([s],
00029   assert(sequal(print2string(f("")),newline) = true),
00030   assert(sequal(print2string(f("X X")),sconcat("X X",newline)) = true),
00031   s : apply(sconcats, create_list("X",i,1,200)),
00032   assert(sequal(print2string(f(s)),sconcat(s,newline)) = true),
00033   true)$
00034 
00035 okltest_sconcatnl(f) := (
00036   assert(sequal(f(),"") = true),
00037   assert(sequal(f(""),newline) = true),
00038   assert(sequal(f("x"),sconcat("x",newline)) = true),
00039   assert(sequal(f("x","bb"),sconcat("x",newline,"bb",newline)) = true),
00040   true)$
00041 
00042 okltest_sconcats(f) := (
00043   assert(sequal(f(),"") = true),
00044   assert(sequal(f(""),space) = true),
00045   assert(sequal(f("x"),sconcat("x",space)) = true),
00046   assert(sequal(f("x","bb"),sconcat("x",space,"bb",space)) = true),
00047   true)$
00048 
00049 okltest_print2string(f) := (
00050   assert(sequal(f(0), "")),
00051   assert(sequal(f(print()), "")),
00052   assert(sequal(f(print("")), sconcat(" ",newline))),
00053   assert(sequal(f(print("x")), sconcat("x ",newline))),
00054   assert(sequal(f((print("x"),print(5))), sconcat("x ",newline,"5 ", newline))),
00055   true)$
00056 
00057