summaryrefslogtreecommitdiff
path: root/test/Examples/Kaleidoscope/Chapter6.test
diff options
context:
space:
mode:
authorLang Hames <lhames@gmail.com>2015-08-27 18:13:34 +0000
committerLang Hames <lhames@gmail.com>2015-08-27 18:13:34 +0000
commitb325a1ace53c1f0b1b38505fefeb08114f40dc10 (patch)
treeab62639f1f02696b1bfd37cea626b6df495fc3b4 /test/Examples/Kaleidoscope/Chapter6.test
parent2b96ce62f49d4701bc9880e27ebc894a371342e2 (diff)
Add Kaleidoscope regression tests.
These will be run if LLVM_BUILD_EXAMPLES is enabled. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246175 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Examples/Kaleidoscope/Chapter6.test')
-rw-r--r--test/Examples/Kaleidoscope/Chapter6.test15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/Examples/Kaleidoscope/Chapter6.test b/test/Examples/Kaleidoscope/Chapter6.test
new file mode 100644
index 00000000000..cbdd01f5268
--- /dev/null
+++ b/test/Examples/Kaleidoscope/Chapter6.test
@@ -0,0 +1,15 @@
+# RUN: Kaleidoscope-Ch6 < %s 2>&1 | FileCheck %s
+
+# Test unary operator definition.
+def unary-(x) 0 - x;
+1 + (-1);
+# CHECK: Evaluated to 0.000000
+
+# Test binary operator definition.
+def binary> 10 (lhs rhs) rhs < lhs;
+def foo(x) if x > 10 then 0 else 1;
+foo(9);
+foo(11);
+# CHECK: Evaluated to 1.000000
+# CHECK: Evaluated to 0.000000
+