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

Example of three-valued logic.


diffs (137 lines):

diff --git a/monetdb5/mal/Tests/All b/monetdb5/mal/Tests/All
--- a/monetdb5/mal/Tests/All
+++ b/monetdb5/mal/Tests/All
@@ -54,6 +54,7 @@ tst055
 tst056
 tst057
 tst058
+tst059
 tst060
 tst061
 tst070
diff --git a/monetdb5/mal/Tests/tst059.mal b/monetdb5/mal/Tests/tst059.mal
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/Tests/tst059.mal
@@ -0,0 +1,27 @@
+# three valued logic, using a sequential plan
+# for use in parallel blocks check for the nil in both branches
+# F b1 THEN RETURN 1;
+# ELSEIF NOT(b1) THEN RETURN 0;
+#  ELSE RETURN NULL;
+# END IF;
+
+function threevaluedlogic(B:bit):bit;
+       threevaluedlogic:int:= nil:int ;
+       barrier X_2 := B;
+               return threevaluedlogic:int  := 1:int;
+       exit X_2;
+       barrier X_8 := calc.isnil(B);
+               return threevaluedlogic:int  := nil:int;
+       exit X_8;
+       barrier X_6 := calc.not(B);
+               return threevaluedlogic:int  := 0:int;
+       exit X_6;
+       return threevaluedlogic:int;
+end threevaluedlogic;
+
+z1:= threevaluedlogic(true);
+io.print(z1);
+z2:= threevaluedlogic(false);
+io.print(z2);
+z3:= threevaluedlogic(nil:bit);
+io.print(z3);
diff --git a/monetdb5/mal/Tests/tst059.stable.err 
b/monetdb5/mal/Tests/tst059.stable.err
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/Tests/tst059.stable.err
@@ -0,0 +1,30 @@
+stderr of test 'tst059` in directory 'monetdb5/mal` itself:
+
+
+# 18:17:50 >  
+# 18:17:50 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=32986" "--set" 
"mapi_usock=/var/tmp/mtest-11633/.s.monetdb.32986" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/export/scratch1/mk/default//Linux/var/MonetDB/mTests_monetdb5_mal" 
"tst059.mal"
+# 18:17:50 >  
+
+# builtin opt  gdk_dbpath = 
/export/scratch1/mk/default//Linux/var/monetdb5/dbfarm/demo
+# builtin opt  gdk_debug = 0
+# builtin opt  gdk_vmtrim = no
+# 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  mapi_open = true
+# cmdline opt  mapi_port = 32986
+# cmdline opt  mapi_usock = /var/tmp/mtest-11633/.s.monetdb.32986
+# cmdline opt  monet_prompt = 
+# cmdline opt  mal_listing = 2
+# cmdline opt  gdk_dbpath = 
/export/scratch1/mk/default//Linux/var/MonetDB/mTests_monetdb5_mal
+# cmdline opt  gdk_debug = 536870922
+
+# 18:17:50 >  
+# 18:17:50 >  "Done."
+# 18:17:50 >  
+
diff --git a/monetdb5/mal/Tests/tst059.stable.out 
b/monetdb5/mal/Tests/tst059.stable.out
new file mode 100644
--- /dev/null
+++ b/monetdb5/mal/Tests/tst059.stable.out
@@ -0,0 +1,54 @@
+stdout of test 'tst059` in directory 'monetdb5/mal` itself:
+
+
+# 18:17:50 >  
+# 18:17:50 >  "mserver5" "--debug=10" "--set" "gdk_nr_threads=0" "--set" 
"mapi_open=true" "--set" "mapi_port=32986" "--set" 
"mapi_usock=/var/tmp/mtest-11633/.s.monetdb.32986" "--set" "monet_prompt=" 
"--forcemito" "--set" "mal_listing=2" 
"--dbpath=/export/scratch1/mk/default//Linux/var/MonetDB/mTests_monetdb5_mal" 
"tst059.mal"
+# 18:17:50 >  
+
+# MonetDB 5 server v11.20.0
+# This is an unreleased version
+# Serving database 'mTests_monetdb5_mal', using 8 threads
+# Compiled for x86_64-unknown-linux-gnu/64bit with 64bit OIDs and 128bit 
integers dynamically linked
+# Found 15.590 GiB available main-memory.
+# Copyright (c) 1993-July 2008 CWI.
+# Copyright (c) August 2008-2014 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:32986/
+# Listening for UNIX domain connection requests on 
mapi:monetdb:///var/tmp/mtest-11633/.s.monetdb.32986
+# MonetDB/GIS module loaded
+# MonetDB/SQL module loaded
+function user.threevaluedlogic(B:bit):int;
+    threevaluedlogic:int  := nil:int;
+barrier X_2 := B;
+    return threevaluedlogic:int  := 1:int;
+exit X_2;
+barrier X_8 := calc.isnil(B);
+    return threevaluedlogic:int  := nil:int;
+exit X_8;
+barrier X_6 := calc.not(B);
+    return threevaluedlogic:int  := 0:int;
+exit X_6;
+    return threevaluedlogic:int  := threevaluedlogic;
+end threevaluedlogic;
+function user.main():void;
+# three valued logic, using a sequential plan 
+# for use in parallel blocks check for the nil in both branches 
+# F b1 THEN RETURN 1; 
+# ELSEIF NOT(b1) THEN RETURN 0; 
+#  ELSE RETURN NULL; 
+# END IF; 
+    z1 := user.threevaluedlogic(true);
+    io.print(z1);
+    z2 := user.threevaluedlogic(false);
+    io.print(z2);
+    z3 := user.threevaluedlogic(nil:bit);
+    io.print(z3);
+end main;
+[ 1 ]
+[ 0 ]
+[ nil ]
+
+# 18:17:50 >  
+# 18:17:50 >  "Done."
+# 18:17:50 >  
+
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to