From 6aa0e0017d7d0cddc006da885946934b06949a91 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 14 Oct 2011 04:55:05 +0200 Subject: include libslang-1.4.9 and automatically build it and link erlang-slang against it few (erlang) people will still have libslang-1.4.9 installed or spend time to get it to link against the driver --- libslang/src/test/bstring.sl | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 libslang/src/test/bstring.sl (limited to 'libslang/src/test/bstring.sl') diff --git a/libslang/src/test/bstring.sl b/libslang/src/test/bstring.sl new file mode 100644 index 0000000..3ac8a3d --- /dev/null +++ b/libslang/src/test/bstring.sl @@ -0,0 +1,32 @@ +_debug_info = 1; () = evalfile ("inc.sl"); + +print ("Testing Binary Strings..."); + +variable a = "\000A\000B\000C\000D"; + +if (typeof (a) != BString_Type) failed ("typeof"); + +if (bstrlen (a) != 8) failed ("bstrlen"); + +if ((a[[0:7:2]] != "\000\000\000\000") + or (a[[1:7:2]] != "ABCD")) failed ("array indexing"); + +if (strlen (a) != 0) failed ("typecast"); + +a += "XYZ"; + +if (a[[8:]] != "XYZ") failed ("+= op"); + +a = "XYZ" + a; +if (a == "XYZ") failed ("== op"); + +if (strcmp (a, "XYZ")) failed ("failed strcmp"); + +loop (1000) +{ + a = "\000A\000B\000C\000D"; + a = "A\000B\000C\000"; +} + +print ("Ok\n"); +exit (0); -- cgit v1.2.3