const std = @import("std"); test "expect addOne adds one to 41" { // The Standard Library contains useful functions to help create tests. // `expect` is a function that verifies its argument is true. // It will return an error if its argument is false to indicate a failure. // `try` is used to return an error to the test runner to notify it that the test failed. try std.testing.expect(addOne(41) == 42); // However, in most cases it is more convenient to use a more specific function like `expectEqual`. // This gives you much clearer and more helpful error messages when a test fails. try std.testing.expectEqual(42, addOne(41)); } test addOne { // A test name can also be written using an identifier. // This is a doctest, and serves as documentation for `addOne`. try std.testing.expectEqual(42, addOne(41)); } /// The function `addOne` adds one to the number given as its argument. fn addOne(number: i32) i32 { return number + 1; } // test