Changeset: 346c03b15de4 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=346c03b15de4
Added Files:
        monetdb5/mal/Tests/tst1506.mal
        monetdb5/mal/Tests/tst1506.stable.err
        monetdb5/mal/Tests/tst1506.stable.out
Modified Files:
        monetdb5/mal/Tests/All
Branch: default
Log Message:

Add test for BAT ifthen module


diffs (270 lines):

diff --git a/monetdb5/mal/Tests/All b/monetdb5/mal/Tests/All
--- a/monetdb5/mal/Tests/All
+++ b/monetdb5/mal/Tests/All
@@ -101,6 +101,7 @@ tst1502
 tst1503
 tst1504
 tst1505
+tst1506
 tst161
 tst162
 tst163
diff --git a/monetdb5/mal/Tests/tst1506.mal b/monetdb5/mal/Tests/tst1506.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/Tests/tst1506.mal
@@ -0,0 +1,43 @@
+       x:= bat.new(:oid,:bit);
+       x:= bat.append(x,true);
+       x:= bat.append(x,false);
+       x:= bat.append(x,nil:bit);
+       io.print(x);
+
+       Ai:= bat.new(:oid,:int);
+       bat.append(Ai,1);
+       bat.append(Ai,2);
+       bat.append(Ai,3);
+       Air:= bat.new(:oid,:int);
+       bat.append(Air,-1);
+       bat.append(Air,-2);
+       bat.append(Air,-3);
+       As:= bat.new(:oid,:str);
+       bat.append(As,"hello");
+       bat.append(As,"new");
+       bat.append(As,"world");
+       Asr:= bat.new(:oid,:str);
+       bat.append(Asr,"HELLO");
+       bat.append(Asr,"NEW");
+       bat.append(Asr,"WORLD");
+       io.print(Ai);
+       io.print(Air);
+       io.print(As);
+       io.print(Asr);
+
+io.print("ifthen group");
+       xif0:= batcalc.ifthen(x,Ai);io.print(x,xif0);
+       xif0:= batcalc.ifthen(x,888);io.print(x,xif0);
+       xif2:= batcalc.ifthenelse(x,Ai,Air);io.print(x,xif2);
+       xif2:= batcalc.ifthenelse(x,Ai,-999);io.print(x,xif2);
+       xif2:= batcalc.ifthenelse(x,999,Air);io.print(x,xif2);
+
+       sif0:= batcalc.ifthen(x,As);io.print(x,sif0);
+       sif0:= batcalc.ifthen(x,"moon");io.print(x,sif0);
+       sif2:= batcalc.ifthenelse(x,As,Asr);io.print(x,sif2);
+       sif2:= batcalc.ifthenelse(x,As,"unknown");io.print(x,sif2);
+       sif2:= batcalc.ifthenelse(x,"unknown",Asr);io.print(x,sif2);
+
+       xif1:= batcalc.ifthen(x,false);io.print(x,xif1);
+       xif3:= batcalc.ifthenelse(x,x,true);io.print(x,x,xif3);
+       xif4:= batcalc.ifthenelse(x,1,2);io.print(x,xif4);
diff --git a/monetdb5/mal/Tests/tst1506.stable.err 
b/monetdb5/mal/Tests/tst1506.stable.err
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/Tests/tst1506.stable.err
@@ -0,0 +1,34 @@
+stderr of test 'tst1506` in directory 'mal` itself:
+
+
+# 13:51:16 >  
+# 13:51:16 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/export/scratch1/mk/current//Linux/var/MonetDB" "--set" 
"mapi_open=true" "--set" "mapi_port=30944" "--set" "monet_prompt=" "--trace" 
"--forcemito" "--set" "mal_listing=2" "--dbname=mTests_mal" "tst1506.mal"
+# 13:51:16 >  
+
+# builtin opt  gdk_dbname = demo
+# builtin opt  gdk_dbfarm = 
/export/scratch1/mk/current//Linux/var/monetdb5/dbfarm
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_alloc_map = no
+# builtin opt  gdk_vmtrim = yes
+# builtin opt  monet_prompt = >
+# builtin opt  monet_daemon = no
+# builtin opt  mapi_port = 50000
+# builtin opt  mapi_open = false
+# builtin opt  mapi_autosense = false
+# builtin opt  sql_optimizer = default_pipe
+# builtin opt  sql_debug = 0
+# cmdline opt  gdk_nr_threads = 0
+# cmdline opt  gdk_dbfarm = /export/scratch1/mk/current//Linux/var/MonetDB
+# cmdline opt  mapi_open = true
+# cmdline opt  mapi_port = 30944
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbname = mTests_mal
+mserver5: /export/scratch1/mk/current//package/gdk/gdk_bat.c:2903: 
BATassertHeadProps: Assertion `!b->H->revsorted || cmp >= 0' failed.
+
+Aborted
+
+# 13:51:17 >  
+# 13:51:17 >  "Done."
+# 13:51:17 >  
+
diff --git a/monetdb5/mal/Tests/tst1506.stable.out 
b/monetdb5/mal/Tests/tst1506.stable.out
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/Tests/tst1506.stable.out
@@ -0,0 +1,167 @@
+stdout of test 'tst1506` in directory 'mal` itself:
+
+
+# 13:51:16 >  
+# 13:51:16 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"gdk_dbfarm=/export/scratch1/mk/current//Linux/var/MonetDB" "--set" 
"mapi_open=true" "--set" "mapi_port=30944" "--set" "monet_prompt=" "--trace" 
"--forcemito" "--set" "mal_listing=2" "--dbname=mTests_mal" "tst1506.mal"
+# 13:51:16 >  
+
+# MonetDB 5 server v11.12.0
+# This is an unreleased version
+# Serving database 'mTests_mal', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs dynamically 
linked
+# Found 15.629 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2012 MonetDB B.V., all rights reserved
+# Visit http://www.monetdb.org/ for further information
+# Listening for connection requests on mapi:monetdb://vienna.ins.cwi.nl:30944/
+# MonetDB/GIS module loaded
+# MonetDB/JAQL module loaded
+# MonetDB/SQL module loaded
+# MonetDB/DataCell loaded
+function user.main():void;
+    x := bat.new(:oid,:bit);
+    x := bat.append(x,true);
+    x := bat.append(x,false);
+    x := bat.append(x,nil:bit);
+    io.print(x);
+    Ai := bat.new(:oid,:int);
+    bat.append(Ai,1);
+    bat.append(Ai,2);
+    bat.append(Ai,3);
+    Air := bat.new(:oid,:int);
+    bat.append(Air,-1);
+    bat.append(Air,-2);
+    bat.append(Air,-3);
+    As := bat.new(:oid,:str);
+    bat.append(As,"hello");
+    bat.append(As,"new");
+    bat.append(As,"world");
+    Asr := bat.new(:oid,:str);
+    bat.append(Asr,"HELLO");
+    bat.append(Asr,"NEW");
+    bat.append(Asr,"WORLD");
+    io.print(Ai);
+    io.print(Air);
+    io.print(As);
+    io.print(Asr);
+    io.print("ifthen group");
+    xif0 := batcalc.ifthen(x,Ai);
+    io.print(x,xif0);
+    xif0 := batcalc.ifthen(x,888);
+    io.print(x,xif0);
+    xif2 := batcalc.ifthenelse(x,Ai,Air);
+    io.print(x,xif2);
+    xif2 := batcalc.ifthenelse(x,Ai,-999);
+    io.print(x,xif2);
+    xif2 := batcalc.ifthenelse(x,999,Air);
+    io.print(x,xif2);
+    sif0 := batcalc.ifthen(x,As);
+    io.print(x,sif0);
+    sif0 := batcalc.ifthen(x,"moon");
+    io.print(x,sif0);
+    sif2 := batcalc.ifthenelse(x,As,Asr);
+    io.print(x,sif2);
+    sif2 := batcalc.ifthenelse(x,As,"unknown");
+    io.print(x,sif2);
+    sif2 := batcalc.ifthenelse(x,"unknown",Asr);
+    io.print(x,sif2);
+    xif1 := batcalc.ifthen(x,false);
+    io.print(x,xif1);
+    xif3 := batcalc.ifthenelse(x,x,true);
+    io.print(x,x,xif3);
+    xif4 := batcalc.ifthenelse(x,1,2);
+    io.print(x,xif4);
+end main;
+#-----------------#
+# h    t         # name
+# void bit       # type
+#-----------------#
+[ 0@0,   true    ]
+[ 1@0,   false   ]
+[ 2@0,   nil     ]
+#-----------------#
+# h    t         # name
+# void int       # type
+#-----------------#
+[ 0@0,   1       ]
+[ 1@0,   2       ]
+[ 2@0,   3       ]
+#-----------------#
+# h    t         # name
+# void int       # type
+#-----------------#
+[ 0@0,   -1      ]
+[ 1@0,   -2      ]
+[ 2@0,   -3      ]
+#-------------------------#
+# h    t                 # name
+# void str               # type
+#-------------------------#
+[ 0@0,   "hello"         ]
+[ 1@0,   "new"           ]
+[ 2@0,   "world"         ]
+#-------------------------#
+# h    t                 # name
+# void str               # type
+#-------------------------#
+[ 0@0,   "HELLO"         ]
+[ 1@0,   "NEW"           ]
+[ 2@0,   "WORLD"         ]
+[ "ifthen group" ]
+#-------------------------#
+# h    t       t         # name
+# void bit     int       # type
+#-------------------------#
+[ 0@0,   true,   1       ]
+[ 2@0,   nil,    nil     ]
+#-------------------------#
+# h    t       t         # name
+# void bit     int       # type
+#-------------------------#
+[ 0@0,   true,   888     ]
+[ 2@0,   nil,    nil     ]
+#-------------------------#
+# h    t       t         # name
+# void bit     int       # type
+#-------------------------#
+[ 0@0,   true,   1       ]
+[ 1@0,   false,  -2      ]
+[ 2@0,   nil,    nil     ]
+#-------------------------#
+# h    t       t         # name
+# void bit     int       # type
+#-------------------------#
+[ 0@0,   true,   1       ]
+[ 1@0,   false,  -999    ]
+[ 2@0,   nil,    nil     ]
+#-------------------------#
+# h    t       t         # name
+# void bit     int       # type
+#-------------------------#
+[ 0@0,   true,   999     ]
+[ 1@0,   false,  -2      ]
+[ 2@0,   nil,    nil     ]
+#---------------------------------#
+# h    t       t                 # name
+# void bit     str               # type
+#---------------------------------#
+[ 0@0,   true,   "hello"         ]
+[ 2@0,   nil,    nil             ]
+#-------------------------#
+# h    t       t         # name
+# void bit     str       # type
+#-------------------------#
+[ 0@0,   true,   "moon"  ]
+[ 2@0,   nil,    nil     ]
+#---------------------------------#
+# h    t       t                 # name
+# void bit     str               # type
+#---------------------------------#
+[ 0@0,   true,   "hello"         ]
+[ 1@0,   false,  "NEW"           ]
+[ 2@0,   nil,    nil             ]
+
+# 13:51:17 >  
+# 13:51:17 >  "Done."
+# 13:51:17 >  
+
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to