diff options
54 files changed, 854 insertions, 0 deletions
diff --git a/tests/pracownia4/00_sum.xi b/tests/pracownia4/00_sum.xi new file mode 100644 index 0000000..1ed3aa2 --- /dev/null +++ b/tests/pracownia4/00_sum.xi @@ -0,0 +1,23 @@ +printInt(x:int) + +sumtab(xs:int[]):int { + sum:int = 0 + i:int = 0 + n:int = length(xs) + while (i < n) { + sum = sum + xs[i] + i = i + 1 + } + return sum +} + +main():int +{ + xs:int[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } + printInt(sumtab(xs)) + return 0 +} + +//@PRACOWNIA +//@out 45 +//@out Exit code: 0
\ No newline at end of file diff --git a/tests/pracownia4/01_sort.xi b/tests/pracownia4/01_sort.xi new file mode 100644 index 0000000..e875eaf --- /dev/null +++ b/tests/pracownia4/01_sort.xi @@ -0,0 +1,31 @@ +printString(x:int[]) + +sort(a: int[]) { + i:int = 0 + n:int = length(a) + while (i < n) { + j:int = i + while (j > 0) { + if (a[j-1] > a[j]) { + swap:int = a[j] + a[j] = a[j-1] + a[j-1] = swap + } + j = j-1 + } + i = i+1 + } +} + + +main():int +{ + x:int[] = "Wroclaw" + sort(x) + printString(x) + return 1 +} + +//@PRACOWNIA +//@out Waclorw +//@out Exit code: 1
\ No newline at end of file diff --git a/tests/pracownia4/02_flatten_easy.xi b/tests/pracownia4/02_flatten_easy.xi new file mode 100644 index 0000000..207bb7c --- /dev/null +++ b/tests/pracownia4/02_flatten_easy.xi @@ -0,0 +1,31 @@ +printString(xs:int[]) + +flatten_easy(xss:int[][]):int[] +{ + xs:int[] = {} + n:int = length(xss) + i:int = 0 + while (i < n) { + xs = xs + xss[i] + i = i + 1 + } + + return xs +} + +main():int +{ + xss:int[][] = { + "Uniwersytet", + " ", + "Wroclawski" + } + + printString(flatten_easy(xss)) + + return 0 +} + +//@PRACOWNIA +//@out Uniwersytet Wroclawski +//@out Exit code: 0
\ No newline at end of file diff --git a/tests/pracownia4/03_flatten_hard.xi b/tests/pracownia4/03_flatten_hard.xi new file mode 100644 index 0000000..877a724 --- /dev/null +++ b/tests/pracownia4/03_flatten_hard.xi @@ -0,0 +1,36 @@ +printString(xs:int[]) + +flatten_hard(xss:int[][]):int[] +{ + xs:int[] = {} + n:int = length(xss) + i:int = 0 + while (i < n) { + m:int = length(xss[i]) + j:int = 0 + while (j < m) { + xs = xs + {xss[i][j]} + j = j + 1 + } + i = i + 1 + } + + return xs +} + +main():int +{ + xss:int[][] = { + "Uniwersytet", + " ", + "Wroclawski" + } + + printString(flatten_hard(xss)) + + return 0 +} + +//@PRACOWNIA +//@out Uniwersytet Wroclawski +//@out Exit code: 0
\ No newline at end of file diff --git a/tests/pracownia4/40_manyvars.xi b/tests/pracownia4/40_manyvars.xi new file mode 100644 index 0000000..c86bcd9 --- /dev/null +++ b/tests/pracownia4/40_manyvars.xi @@ -0,0 +1,64 @@ +f(values:int[]):int +{ + r0:int = values[0] + r1:int = values[1] + r2:int = values[2] + r3:int = values[3] + r4:int = values[4] + r5:int = values[5] + r6:int = values[6] + r7:int = values[7] + r8:int = values[8] + r9:int = values[9] + r10:int = values[10] + r11:int = values[11] + r12:int = values[12] + r13:int = values[13] + r14:int = values[14] + r15:int = values[15] + r16:int = values[16] + r17:int = values[17] + r18:int = values[18] + r19:int = values[19] + r20:int = values[20] + r21:int = values[21] + r22:int = values[22] + r23:int = values[23] + r24:int = values[24] + r25:int = values[25] + r26:int = values[26] + r27:int = values[27] + r28:int = values[28] + r29:int = values[29] + r30:int = values[30] + r31:int = values[31] + r32:int = values[32] + r33:int = values[33] + r34:int = values[34] + r35:int = values[35] + r36:int = values[36] + r37:int = values[37] + r38:int = values[38] + r39:int = values[39] + return r0 + r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8 + r9 + r10 + r11 + r12 + r13 + r14 + r15 + r16 + r17 + r18 + r19 + r20 + r21 + r22 + r23 + r24 + r25 + r26 + r27 + r28 + r29 + r30 + r31 + r32 + r33 + r34 + r35 + r36 + r37 + r38 + r39 +} +prepare_values(n:int):int[] +{ + result:int[] = {} + i:int = 0 + while (i < n) { + result = result + {i*10} + i = i + 1 + } + return result +} + +main():int +{ + values:int[] = prepare_values(40) + return f(values) +} + +//@PRACOWNIA +//@out Exit code: 7800 + diff --git a/tests/pracownia4/40_manyvars_rec.xi b/tests/pracownia4/40_manyvars_rec.xi new file mode 100644 index 0000000..3aacd1a --- /dev/null +++ b/tests/pracownia4/40_manyvars_rec.xi @@ -0,0 +1,109 @@ +f(values:int[]):int +{ + r0:int = values[0] + r1:int = values[1] + r2:int = values[2] + r3:int = values[3] + r4:int = values[4] + r5:int = values[5] + r6:int = values[6] + r7:int = values[7] + r8:int = values[8] + r9:int = values[9] + r10:int = values[10] + r11:int = values[11] + r12:int = values[12] + r13:int = values[13] + r14:int = values[14] + r15:int = values[15] + r16:int = values[16] + r17:int = values[17] + r18:int = values[18] + r19:int = values[19] + r20:int = values[20] + r21:int = values[21] + r22:int = values[22] + r23:int = values[23] + r24:int = values[24] + r25:int = values[25] + r26:int = values[26] + r27:int = values[27] + r28:int = values[28] + r29:int = values[29] + r30:int = values[30] + r31:int = values[31] + r32:int = values[32] + r33:int = values[33] + r34:int = values[34] + r35:int = values[35] + r36:int = values[36] + r37:int = values[37] + r38:int = values[38] + r39:int = values[39] + return r0 + r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8 + r9 + r10 + r11 + r12 + r13 + r14 + r15 + r16 + r17 + r18 + r19 + r20 + r21 + r22 + r23 + r24 + r25 + r26 + r27 + r28 + r29 + r30 + r31 + r32 + r33 + r34 + r35 + r36 + r37 + r38 + r39 +} +g(values:int[]):int +{ + r0:int = values[0] + r1:int = values[1] + r2:int = values[2] + r3:int = values[3] + r4:int = values[4] + r5:int = values[5] + r6:int = values[6] + r7:int = values[7] + r8:int = values[8] + r9:int = values[9] + r10:int = values[10] + r11:int = values[11] + r12:int = values[12] + r13:int = values[13] + r14:int = values[14] + r15:int = values[15] + r16:int = values[16] + r17:int = values[17] + r18:int = values[18] + r19:int = values[19] + r20:int = values[20] + r21:int = values[21] + r22:int = values[22] + r23:int = values[23] + r24:int = values[24] + r25:int = values[25] + r26:int = values[26] + r27:int = values[27] + r28:int = values[28] + r29:int = values[29] + r30:int = values[30] + r31:int = values[31] + r32:int = values[32] + r33:int = values[33] + r34:int = values[34] + r35:int = values[35] + r36:int = values[36] + r37:int = values[37] + r38:int = values[38] + r39:int = values[39] + r_f:int = f(values) + return r_f + r0 + r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8 + r9 + r10 + r11 + r12 + r13 + r14 + r15 + r16 + r17 + r18 + r19 + r20 + r21 + r22 + r23 + r24 + r25 + r26 + r27 + r28 + r29 + r30 + r31 + r32 + r33 + r34 + r35 + r36 + r37 + r38 + r39 +} +prepare_values(n:int):int[] +{ + result:int[] = {} + i:int = 0 + while (i < n) { + result = result + {i*10} + i = i + 1 + } + return result +} + +main():int +{ + values:int[] = prepare_values(40) + return g(values) +} + +//@PRACOWNIA +//@out Exit code: 15600 + diff --git a/tests/pracownia4/pracownia3/000_manyargs_3.xi b/tests/pracownia4/pracownia3/000_manyargs_3.xi new file mode 100644 index 0000000..3e73ca9 --- /dev/null +++ b/tests/pracownia4/pracownia3/000_manyargs_3.xi @@ -0,0 +1,11 @@ +f(r0:int, r1:int, r2:int, r3:int, r4:int, r5:int, r6:int):int +{ + return r0 + r1 + r2 + r3 + r4 + r5 + r6 +} + +main():int { + return f(1, 2, 3, 4, 5, 6, 7) +} + +//@PRACOWNIA +//@out Exit code: 28 diff --git a/tests/pracownia4/pracownia3/001_or_01.xi b/tests/pracownia4/pracownia3/001_or_01.xi new file mode 100644 index 0000000..42e3715 --- /dev/null +++ b/tests/pracownia4/pracownia3/001_or_01.xi @@ -0,0 +1,30 @@ +printString(str:int[]) + +pred_lhs():bool +{ + printString("pred_lhs") + return false +} + +pred_rhs():bool +{ + printString("pred_rhs") + return true +} + +main():int +{ + result:int = 3 + if pred_lhs() | pred_rhs() { + result = 1 + } else { + result = 0 + } + + return result +} + +//@PRACOWNIA +//@out pred_lhs +//@out pred_rhs +//@out Exit code: 1 diff --git a/tests/pracownia4/pracownia3/002_list_empty.xi b/tests/pracownia4/pracownia3/002_list_empty.xi new file mode 100644 index 0000000..a7a2c9d --- /dev/null +++ b/tests/pracownia4/pracownia3/002_list_empty.xi @@ -0,0 +1,8 @@ +main():int +{ + x:int[] = {1,2,3} + return 0 +} + +//@PRACOWNIA +//@out Exit code: 0
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/003_concat_rhs_len.xi b/tests/pracownia4/pracownia3/003_concat_rhs_len.xi new file mode 100644 index 0000000..5ab6e64 --- /dev/null +++ b/tests/pracownia4/pracownia3/003_concat_rhs_len.xi @@ -0,0 +1,8 @@ +main():int +{ + z:int[] = {} + {100, 200} + return length(z) +} + +//@PRACOWNIA +//@out Exit code: 2
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/004_return.xi b/tests/pracownia4/pracownia3/004_return.xi new file mode 100644 index 0000000..a24d01a --- /dev/null +++ b/tests/pracownia4/pracownia3/004_return.xi @@ -0,0 +1,12 @@ +return_4():int +{ + return 4 +} + +main():int +{ + return return_4() +} + +//@PRACOWNIA +//@out Exit code: 4
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/005_multireturn_multiargs.xi b/tests/pracownia4/pracownia3/005_multireturn_multiargs.xi new file mode 100644 index 0000000..96fbb57 --- /dev/null +++ b/tests/pracownia4/pracownia3/005_multireturn_multiargs.xi @@ -0,0 +1,12 @@ +f(a0:int, a1:int, a2:int, a3:int, a4:int, a5:int, a6:int): int, int, int, int, int, int, int +{ + return a0, a1, a2, a3, a4, a5, a6 +} + +main():int { + a0:int, a1:int, a2:int, a3:int, a4:int, a5:int, a6:int = f(10,20,30,40,50,60,70) + return a0+a1+a2+a3+a4+a5+a6 +} + +//@PRACOWNIA +//@out Exit code: 280 diff --git a/tests/pracownia4/pracownia3/006_init_variable.xi b/tests/pracownia4/pracownia3/006_init_variable.xi new file mode 100644 index 0000000..27940b7 --- /dev/null +++ b/tests/pracownia4/pracownia3/006_init_variable.xi @@ -0,0 +1,8 @@ +main():int +{ + x:int = 42; + return 13 +} + +//@PRACOWNIA +//@out Exit code: 13
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/007_mul_literals.xi b/tests/pracownia4/pracownia3/007_mul_literals.xi new file mode 100644 index 0000000..4302efe --- /dev/null +++ b/tests/pracownia4/pracownia3/007_mul_literals.xi @@ -0,0 +1,8 @@ + +main():int +{ + return 4 * 3 +} + +//@PRACOWNIA +//@out Exit code: 12
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/008_fac_rec_0.xi b/tests/pracownia4/pracownia3/008_fac_rec_0.xi new file mode 100644 index 0000000..45d5265 --- /dev/null +++ b/tests/pracownia4/pracownia3/008_fac_rec_0.xi @@ -0,0 +1,15 @@ +fac(x:int):int +{ + if (x == 0) { + return 1 + } + return fac(x-1)*x +} + +main():int +{ + return fac(0) +} + +//@PRACOWNIA +//@out Exit code: 1
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/009_while_while_sum.xi b/tests/pracownia4/pracownia3/009_while_while_sum.xi new file mode 100644 index 0000000..abb029c --- /dev/null +++ b/tests/pracownia4/pracownia3/009_while_while_sum.xi @@ -0,0 +1,18 @@ +main():int +{ + i:int = 0; + n:int = 10; + sum:int = 0; + while (i < n) { + j:int = 0 + while (j < n) { + sum = sum + j + j = j + 1 + } + i = i + 1 + } + return sum +} + +//@PRACOWNIA +//@out Exit code: 450
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/010_length_empty.xi b/tests/pracownia4/pracownia3/010_length_empty.xi new file mode 100644 index 0000000..46b3025 --- /dev/null +++ b/tests/pracownia4/pracownia3/010_length_empty.xi @@ -0,0 +1,8 @@ +main():int +{ + x:int[] = {} + return length(x) +} + +//@PRACOWNIA +//@out Exit code: 0
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/011_concat_string.xi b/tests/pracownia4/pracownia3/011_concat_string.xi new file mode 100644 index 0000000..c245c05 --- /dev/null +++ b/tests/pracownia4/pracownia3/011_concat_string.xi @@ -0,0 +1,8 @@ +main():int +{ + x:int[] = "Wro" + "claw" + return length(x) +} + +//@PRACOWNIA +//@out Exit code: 7
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/012_multireturn_4.xi b/tests/pracownia4/pracownia3/012_multireturn_4.xi new file mode 100644 index 0000000..7b1c7b7 --- /dev/null +++ b/tests/pracownia4/pracownia3/012_multireturn_4.xi @@ -0,0 +1,12 @@ +f(): int, int, int, int +{ + return 10, 15, 20, 25 +} + +main():int { + x:int, y:int, z:int, v:int = f() + return x + y + z + v; +} + +//@PRACOWNIA +//@out Exit code: 70 diff --git a/tests/pracownia4/pracownia3/013_add_literals.xi b/tests/pracownia4/pracownia3/013_add_literals.xi new file mode 100644 index 0000000..9ced5c6 --- /dev/null +++ b/tests/pracownia4/pracownia3/013_add_literals.xi @@ -0,0 +1,8 @@ + +main():int +{ + return 4 + 3 +} + +//@PRACOWNIA +//@out Exit code: 7
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/014_assign.xi b/tests/pracownia4/pracownia3/014_assign.xi new file mode 100644 index 0000000..bb62c67 --- /dev/null +++ b/tests/pracownia4/pracownia3/014_assign.xi @@ -0,0 +1,9 @@ +main():int +{ + x:int = 42 + x = 10 + return x +} + +//@PRACOWNIA +//@out Exit code: 10
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/015_sub_literals.xi b/tests/pracownia4/pracownia3/015_sub_literals.xi new file mode 100644 index 0000000..2a8ce93 --- /dev/null +++ b/tests/pracownia4/pracownia3/015_sub_literals.xi @@ -0,0 +1,8 @@ + +main():int +{ + return 4 - 3 +} + +//@PRACOWNIA +//@out Exit code: 1
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/016_fib_rec_3.xi b/tests/pracownia4/pracownia3/016_fib_rec_3.xi new file mode 100644 index 0000000..49a5d5b --- /dev/null +++ b/tests/pracownia4/pracownia3/016_fib_rec_3.xi @@ -0,0 +1,18 @@ +fib(x:int):int +{ + if (x == 0) { + return 0 + } + if (x == 1) { + return 1 + } + return fib(x-1) + fib(x-2) +} + +main():int +{ + return fib(5) +} + +//@PRACOWNIA +//@out Exit code: 5
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/017_return_42.xi b/tests/pracownia4/pracownia3/017_return_42.xi new file mode 100644 index 0000000..6d53081 --- /dev/null +++ b/tests/pracownia4/pracownia3/017_return_42.xi @@ -0,0 +1,8 @@ + +main():int +{ + return 42 +} + +//@PRACOWNIA +//@out Exit code: 42
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/018_empty_main.xi b/tests/pracownia4/pracownia3/018_empty_main.xi new file mode 100644 index 0000000..336daf1 --- /dev/null +++ b/tests/pracownia4/pracownia3/018_empty_main.xi @@ -0,0 +1,8 @@ + +main():int +{ + return 0 +} + +//@PRACOWNIA +//@out Exit code: 0
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/019_while_sum.xi b/tests/pracownia4/pracownia3/019_while_sum.xi new file mode 100644 index 0000000..8821a07 --- /dev/null +++ b/tests/pracownia4/pracownia3/019_while_sum.xi @@ -0,0 +1,14 @@ +main():int +{ + i:int = 0; + n:int = 10; + sum:int = 0; + while (i < n) { + sum = sum + i + i = i + 1 + } + return sum +} + +//@PRACOWNIA +//@out Exit code: 45
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/020_return_variable.xi b/tests/pracownia4/pracownia3/020_return_variable.xi new file mode 100644 index 0000000..288a5eb --- /dev/null +++ b/tests/pracownia4/pracownia3/020_return_variable.xi @@ -0,0 +1,8 @@ +main():int +{ + x:int = 42 + return x +} + +//@PRACOWNIA +//@out Exit code: 42
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/021_printInt.xi b/tests/pracownia4/pracownia3/021_printInt.xi new file mode 100644 index 0000000..5f75922 --- /dev/null +++ b/tests/pracownia4/pracownia3/021_printInt.xi @@ -0,0 +1,16 @@ + +printInt(x:int) + +main():int +{ + printInt(5) + printInt(10) + printInt(15) + return 0 +} + +//@PRACOWNIA +//@out 5 +//@out 10 +//@out 15 +//@out Exit code: 0
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/022_if_eq_true.xi b/tests/pracownia4/pracownia3/022_if_eq_true.xi new file mode 100644 index 0000000..4571f1b --- /dev/null +++ b/tests/pracownia4/pracownia3/022_if_eq_true.xi @@ -0,0 +1,13 @@ +main():int +{ + x:int = 33; + result:int = 99 + if (x == 33) { + result = 100 + } + + return result +} + +//@PRACOWNIA +//@out Exit code: 100
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/023_ifelse_pred.xi b/tests/pracownia4/pracownia3/023_ifelse_pred.xi new file mode 100644 index 0000000..10010d6 --- /dev/null +++ b/tests/pracownia4/pracownia3/023_ifelse_pred.xi @@ -0,0 +1,18 @@ +pred():bool +{ + return true +} + +main():int +{ + result:int = 13 + if pred() { + result = 100 + } else { + result = 1 + } + return result +} + +//@PRACOWNIA +//@out Exit code: 100 diff --git a/tests/pracownia4/pracownia3/024_fac.xi b/tests/pracownia4/pracownia3/024_fac.xi new file mode 100644 index 0000000..381de7c --- /dev/null +++ b/tests/pracownia4/pracownia3/024_fac.xi @@ -0,0 +1,17 @@ +fac(x:int):int +{ + res:int = 1 + while (x > 0) { + res = x*res + x = x - 1 + } + return res +} + +main():int +{ + return fac(5) +} + +//@PRACOWNIA +//@out Exit code: 120
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/025_and_literals.xi b/tests/pracownia4/pracownia3/025_and_literals.xi new file mode 100644 index 0000000..fc87e96 --- /dev/null +++ b/tests/pracownia4/pracownia3/025_and_literals.xi @@ -0,0 +1,16 @@ +convert(b:bool):int +{ + if b { + return 1 + } else { + return 0 + } +} + +main():int +{ + return convert(true & false) +} + +//@PRACOWNIA +//@out Exit code: 0 diff --git a/tests/pracownia4/pracownia3/026_printString.xi b/tests/pracownia4/pracownia3/026_printString.xi new file mode 100644 index 0000000..29dc5aa --- /dev/null +++ b/tests/pracownia4/pracownia3/026_printString.xi @@ -0,0 +1,11 @@ +printString(x:int[]) + +main():int +{ + printString("Wroclaw") + return 0 +} + +//@PRACOWNIA +//@out Wroclaw +//@out Exit code: 0
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/027_init_2_variables.xi b/tests/pracownia4/pracownia3/027_init_2_variables.xi new file mode 100644 index 0000000..b417ab1 --- /dev/null +++ b/tests/pracownia4/pracownia3/027_init_2_variables.xi @@ -0,0 +1,9 @@ +main():int +{ + x:int = 42; + y:int = 43; + return 14 +} + +//@PRACOWNIA +//@out Exit code: 14
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/028_return_second_variable.xi b/tests/pracownia4/pracownia3/028_return_second_variable.xi new file mode 100644 index 0000000..257fce9 --- /dev/null +++ b/tests/pracownia4/pracownia3/028_return_second_variable.xi @@ -0,0 +1,9 @@ +main():int +{ + x:int = 42 + y:int = 43 + return y +} + +//@PRACOWNIA +//@out Exit code: 43
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/029_return_first_variable.xi b/tests/pracownia4/pracownia3/029_return_first_variable.xi new file mode 100644 index 0000000..138a3a2 --- /dev/null +++ b/tests/pracownia4/pracownia3/029_return_first_variable.xi @@ -0,0 +1,9 @@ +main():int +{ + x:int = 42 + y:int = 43 + return x +} + +//@PRACOWNIA +//@out Exit code: 42
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/030_length_string.xi b/tests/pracownia4/pracownia3/030_length_string.xi new file mode 100644 index 0000000..bc6011a --- /dev/null +++ b/tests/pracownia4/pracownia3/030_length_string.xi @@ -0,0 +1,8 @@ +main():int +{ + x:int[] = "Wroclaw" + return length(x) +} + +//@PRACOWNIA +//@out Exit code: 7
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/031_div_literals.xi b/tests/pracownia4/pracownia3/031_div_literals.xi new file mode 100644 index 0000000..16a75f8 --- /dev/null +++ b/tests/pracownia4/pracownia3/031_div_literals.xi @@ -0,0 +1,8 @@ + +main():int +{ + return 8 / 2 +} + +//@PRACOWNIA +//@out Exit code: 4
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/032_return_index0.xi b/tests/pracownia4/pracownia3/032_return_index0.xi new file mode 100644 index 0000000..09ddee4 --- /dev/null +++ b/tests/pracownia4/pracownia3/032_return_index0.xi @@ -0,0 +1,8 @@ +main():int +{ + x:int[] = {5, 10, 15} + return x[0] +} + +//@PRACOWNIA +//@out Exit code: 5
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/033_multiarray.xi b/tests/pracownia4/pracownia3/033_multiarray.xi new file mode 100644 index 0000000..f6fb7b5 --- /dev/null +++ b/tests/pracownia4/pracownia3/033_multiarray.xi @@ -0,0 +1,13 @@ +main():int { + xs:int[2][3]; + xs[0][0] = 1; + xs[0][1] = 2; + xs[0][2] = 3; + xs[1][0] = 10; + xs[1][1] = 20; + xs[1][2] = 30; + return xs[0][0] + xs[0][1] + xs[0][2] + xs[1][0] + xs[1][1] + xs[1][2]; +} + +//@PRACOWNIA +//@out Exit code: 66 diff --git a/tests/pracownia4/pracownia3/034_or_literals.xi b/tests/pracownia4/pracownia3/034_or_literals.xi new file mode 100644 index 0000000..ca1c9da --- /dev/null +++ b/tests/pracownia4/pracownia3/034_or_literals.xi @@ -0,0 +1,15 @@ +convert(b:bool):int +{ + if b { + return 1 + } else { + return 0 + } +} +main():int +{ + return convert(false | true) +} + +//@PRACOWNIA +//@out Exit code: 1 diff --git a/tests/pracownia4/pracownia3/035_return_char.xi b/tests/pracownia4/pracownia3/035_return_char.xi new file mode 100644 index 0000000..689567a --- /dev/null +++ b/tests/pracownia4/pracownia3/035_return_char.xi @@ -0,0 +1,7 @@ +main():int +{ + return 'a' +} + +//@PRACOWNIA +//@out Exit code: 97 diff --git a/tests/pracownia4/pracownia3/036_multireturn_3.xi b/tests/pracownia4/pracownia3/036_multireturn_3.xi new file mode 100644 index 0000000..f8190a8 --- /dev/null +++ b/tests/pracownia4/pracownia3/036_multireturn_3.xi @@ -0,0 +1,12 @@ +f(): int, int, int +{ + return 10, 15, 20 +} + +main():int { + x:int, y:int, z:int = f() + return x + y + z; +} + +//@PRACOWNIA +//@out Exit code: 45 diff --git a/tests/pracownia4/pracownia3/037_concat_lhs_len.xi b/tests/pracownia4/pracownia3/037_concat_lhs_len.xi new file mode 100644 index 0000000..f51c1e0 --- /dev/null +++ b/tests/pracownia4/pracownia3/037_concat_lhs_len.xi @@ -0,0 +1,8 @@ +main():int +{ + z:int[] = {100, 200} + {} + return length(z) +} + +//@PRACOWNIA +//@out Exit code: 2
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/038_fac_rec_5.xi b/tests/pracownia4/pracownia3/038_fac_rec_5.xi new file mode 100644 index 0000000..1258e53 --- /dev/null +++ b/tests/pracownia4/pracownia3/038_fac_rec_5.xi @@ -0,0 +1,15 @@ +fac(x:int):int +{ + if (x == 0) { + return 1 + } + return fac(x-1)*x +} + +main():int +{ + return fac(5) +} + +//@PRACOWNIA +//@out Exit code: 120
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/039_ifelse_eq_true_ret.xi b/tests/pracownia4/pracownia3/039_ifelse_eq_true_ret.xi new file mode 100644 index 0000000..70a6491 --- /dev/null +++ b/tests/pracownia4/pracownia3/039_ifelse_eq_true_ret.xi @@ -0,0 +1,13 @@ +main():int +{ + x:int = 33; + if (x == 33) { + return 100 + } else { + return 10 + } + return 0 +} + +//@PRACOWNIA +//@out Exit code: 100
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/040_string.xi b/tests/pracownia4/pracownia3/040_string.xi new file mode 100644 index 0000000..f046b6b --- /dev/null +++ b/tests/pracownia4/pracownia3/040_string.xi @@ -0,0 +1,8 @@ +main():int +{ + x:int[] = "Wroclaw" + return 13 +} + +//@PRACOWNIA +//@out Exit code: 13
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/041_assign_index0.xi b/tests/pracownia4/pracownia3/041_assign_index0.xi new file mode 100644 index 0000000..f1c39b6 --- /dev/null +++ b/tests/pracownia4/pracownia3/041_assign_index0.xi @@ -0,0 +1,9 @@ +main():int +{ + x:int[] = {5, 10, 15} + x[0] = 20 + return x[0] +} + +//@PRACOWNIA +//@out Exit code: 20
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/042_return_nl.xi b/tests/pracownia4/pracownia3/042_return_nl.xi new file mode 100644 index 0000000..b529e15 --- /dev/null +++ b/tests/pracownia4/pracownia3/042_return_nl.xi @@ -0,0 +1,7 @@ +main():int +{ + return '\n' +} + +//@PRACOWNIA +//@out Exit code: 10 diff --git a/tests/pracownia4/pracownia3/043_while_or.xi b/tests/pracownia4/pracownia3/043_while_or.xi new file mode 100644 index 0000000..5d9525e --- /dev/null +++ b/tests/pracownia4/pracownia3/043_while_or.xi @@ -0,0 +1,18 @@ +pred():bool +{ + return false +} + +main():int +{ + x:bool = true + result:int = 13 + while x | pred() { + result = 100 + x = false + } + return result +} + +//@PRACOWNIA +//@out Exit code: 100 diff --git a/tests/pracownia4/pracownia3/044_list_init.xi b/tests/pracownia4/pracownia3/044_list_init.xi new file mode 100644 index 0000000..a7a2c9d --- /dev/null +++ b/tests/pracownia4/pracownia3/044_list_init.xi @@ -0,0 +1,8 @@ +main():int +{ + x:int[] = {1,2,3} + return 0 +} + +//@PRACOWNIA +//@out Exit code: 0
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/045_mod_literals.xi b/tests/pracownia4/pracownia3/045_mod_literals.xi new file mode 100644 index 0000000..e904355 --- /dev/null +++ b/tests/pracownia4/pracownia3/045_mod_literals.xi @@ -0,0 +1,8 @@ + +main():int +{ + return 3 % 2 +} + +//@PRACOWNIA +//@out Exit code: 1 diff --git a/tests/pracownia4/pracownia3/046_return_index1.xi b/tests/pracownia4/pracownia3/046_return_index1.xi new file mode 100644 index 0000000..b2af5d1 --- /dev/null +++ b/tests/pracownia4/pracownia3/046_return_index1.xi @@ -0,0 +1,8 @@ +main():int +{ + x:int[] = {5, 10, 15} + return x[1] +} + +//@PRACOWNIA +//@out Exit code: 10
\ No newline at end of file diff --git a/tests/pracownia4/pracownia3/047_and_10_.xi b/tests/pracownia4/pracownia3/047_and_10_.xi new file mode 100644 index 0000000..d9469ae --- /dev/null +++ b/tests/pracownia4/pracownia3/047_and_10_.xi @@ -0,0 +1,30 @@ +printString(str:int[]) + +pred_lhs():bool +{ + printString("pred_lhs") + return true +} + +pred_rhs():bool +{ + printString("pred_rhs") + return false +} + +main():int +{ + result:int = 3 + if pred_lhs() & pred_rhs() { + result = 1 + } else { + result = 0 + } + + return result +} + +//@PRACOWNIA +//@out pred_lhs +//@out pred_rhs +//@out Exit code: 0 |