102_testing.patch 624 B

123456789101112131415161718
  1. --- exercises/102_testing.zig 2023-10-03 22:15:22.125574535 +0200
  2. +++ answers/102_testing.zig 2023-10-05 20:04:07.302771500 +0200
  3. @@ -83,7 +83,7 @@
  4. // an error that you need
  5. // to correct.
  6. test "sub" {
  7. - try testing.expect(sub(10, 5) == 6);
  8. + try testing.expect(sub(10, 5) == 5);
  9. try testing.expect(sub(3, 1.5) == 1.5);
  10. }
  11. @@ -108,5 +108,5 @@
  12. // Now we test if the function returns an error
  13. // if we pass a zero as denominator.
  14. // But which error needs to be tested?
  15. - try testing.expectError(error.???, divide(15, 0));
  16. + try testing.expectError(error.DivisionByZero, divide(15, 0));
  17. }