xref: /aosp_15_r20/external/llvm/test/Examples/Kaleidoscope/Chapter4.test (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker# RUN: Kaleidoscope-Ch4 < %s 2>&1 | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker# Test basic definition, binding, and execution.
4*9880d681SAndroid Build Coastguard Workerdef foo(x) x + 1;
5*9880d681SAndroid Build Coastguard Workerdef bar(x) foo(2 * x);
6*9880d681SAndroid Build Coastguard Workerbar(2);
7*9880d681SAndroid Build Coastguard Worker# CHECK: Evaluated to 5.000000
8*9880d681SAndroid Build Coastguard Worker
9*9880d681SAndroid Build Coastguard Worker# Test redefinition.
10*9880d681SAndroid Build Coastguard Workerdef foo(x) x + 2;
11*9880d681SAndroid Build Coastguard Workerfoo(2);
12*9880d681SAndroid Build Coastguard Worker# CHECK: Evaluated to 4.000000
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker# Verify that 'bar' still calls the original 'foo'.
15*9880d681SAndroid Build Coastguard Workerbar(2);
16*9880d681SAndroid Build Coastguard Worker# CHECK: Evaluated to 5.000000
17*9880d681SAndroid Build Coastguard Worker
18