-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_example.ecl
More file actions
45 lines (37 loc) · 834 Bytes
/
test_example.ecl
File metadata and controls
45 lines (37 loc) · 834 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// SPDX-License-Identifier: MIT
// Example test file demonstrating the testing framework
def add(x: Int, y: Int) -> Int {
x + y
}
def multiply(x: Int, y: Int) -> Int {
x * y
}
#[test]
def test_addition() -> Bool {
add(2, 3) == 5
}
#[test]
def test_multiplication() -> Bool {
multiply(3, 4) == 12
}
#[test]
def test_zero_addition() -> Bool {
add(0, 5) == 5
}
#[test]
#[ignore]
def test_ignored_example() -> Bool {
// This test will be skipped
false
}
#[test]
def test_should_fail() -> Bool {
// This test intentionally fails to demonstrate failure reporting
add(2, 2) == 5
}
fn main() {
println("=== Test Framework Demo (manual run) ===")
println("add(2, 3) =", add(2, 3))
println("multiply(3, 4) =", multiply(3, 4))
println("Use `eclexia test` to run #[test] functions.")
}