[Checkins] SVN: Sandbox/adamg/ocql/trunk/src/ocql/compiler/compiler.txt add a test
Charith Paranaliyanage
paranaliyanage at gmail.com
Wed Aug 27 10:19:59 EDT 2008
Log message for revision 90457:
add a test
Changed:
U Sandbox/adamg/ocql/trunk/src/ocql/compiler/compiler.txt
-=-
Modified: Sandbox/adamg/ocql/trunk/src/ocql/compiler/compiler.txt
===================================================================
--- Sandbox/adamg/ocql/trunk/src/ocql/compiler/compiler.txt 2008-08-27 14:13:13 UTC (rev 90456)
+++ Sandbox/adamg/ocql/trunk/src/ocql/compiler/compiler.txt 2008-08-27 14:19:58 UTC (rev 90457)
@@ -120,6 +120,13 @@
'reduce(operator.add, map(lambda i: 1, reduce(operator.add, map(lambda i: [i], list(metadata.getAll("ICourse"))), [])), 0)'
+ >>> aopt, run = make("list [ c in ICourse; c.credits > 3 | c.code ]")
+ >>> aopt
+ Head(Iter(<type 'list'>, Lambda c: If(c.credits > `3`, Single(<type 'list'>, c.code), Empty(<type 'list'>)), Make(<type 'list'>, <type 'set'>, ICourse)))
+ >>> run.code
+ 'reduce(operator.add, map(lambda c: ((c.credits>3) and ([c.code]) or ([])), list(metadata.getAll("ICourse"))), [])'
+
+
>>> aopt, run = make("set [ c in ICourse; a as c.credits; a > 3 | c.code ]")
>>> aopt
Head(Iter(<type 'set'>, Lambda c: Iter(<type 'set'>,
More information about the Checkins
mailing list