diff --git a/docs/01-program-design.md b/docs/01-program-design.md index d74c329..152c85e 100644 --- a/docs/01-program-design.md +++ b/docs/01-program-design.md @@ -65,8 +65,8 @@ The process of writing test cases not only helps in validating the solution but ```moonbit test { - @test.eq(num_water_bottles(9, 3), 13)! // 9 + 3 + 1 = 13 - @test.eq(num_water_bottles(15, 4), 19)! + @test.eq!(num_water_bottles(9, 3), 13) // 9 + 3 + 1 = 13 + @test.eq!(num_water_bottles(15, 4), 19) } ``` @@ -91,12 +91,12 @@ fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int { } test { - @test.eq(num_water_bottles(9, 3), 13)! // 9 + 3 + 1 = 13 - @test.eq(num_water_bottles(15, 4), 19)! + @test.eq!(num_water_bottles(9, 3), 13) // 9 + 3 + 1 = 13 + @test.eq!(num_water_bottles(15, 4), 19) } ``` -The program can be verified by executing it [here](https://try.moonbitlang.com/#f9b7f68d). If there is no output, it indicates that the program has performed as expected. Alternatively, if we modify the test cases and then rerun the program, an error might be observed. +The program can be verified by executing it [here](https://try.moonbitlang.com/#79f7b666). If there is no output, it indicates that the program has performed as expected. Alternatively, if we modify the test cases and then rerun the program, an error might be observed. ### Summary diff --git a/docs/02-development-environments-expressions.md b/docs/02-development-environments-expressions.md index 3b39bba..6defca2 100644 --- a/docs/02-development-environments-expressions.md +++ b/docs/02-development-environments-expressions.md @@ -58,8 +58,8 @@ fn num_water_bottles(num_bottles: Int, num_exchange: Int) -> Int { // test block test { // statements - @test.eq(num_water_bottles(9, 3), 13)! - @test.eq(num_water_bottles(15, 4), 19)! + @test.eq!(num_water_bottles(9, 3), 13) + @test.eq!(num_water_bottles(15, 4), 19) } ``` diff --git a/docs/12-autodiff.md b/docs/12-autodiff.md index c41d99f..275628e 100644 --- a/docs/12-autodiff.md +++ b/docs/12-autodiff.md @@ -108,11 +108,11 @@ fn example() -> Symbol { test "Symbolic differentiation" { let input : Array[Double] = [10.0, 100.0] let symbol : Symbol = example() // Abstract syntax tree of the function - @test.eq(symbol.compute(input), 600.0)! + @test.eq!(symbol.compute(input), 600.0) // Expression of df/dx - inspect(symbol.differentiate(0), - content="Add(Add(Mul(Mul(Constant(5.0), Var(0)), Constant(1.0)), Mul(Add(Mul(Constant(5.0), Constant(1.0)), Mul(Constant(0.0), Var(0))), Var(0))), Constant(0.0))")! - @test.eq(symbol.differentiate(0).compute(input), 100.0)! + inspect!(symbol.differentiate(0), + content="Add(Add(Mul(Mul(Constant(5.0), Var(0)), Constant(1.0)), Mul(Add(Mul(Constant(5.0), Constant(1.0)), Mul(Constant(0.0), Var(0))), Var(0))), Constant(0.0))") + @test.eq!(symbol.differentiate(0).compute(input), 100.0) } ```