aboutsummaryrefslogtreecommitdiff
path: root/exercises
diff options
context:
space:
mode:
authorDave Gauer <dave@ratfactor.com>2021-04-04 16:23:27 -0400
committerDave Gauer <dave@ratfactor.com>2021-04-04 16:29:28 -0400
commitbed01210e0fc2b3d84741c3a4731be73e1cec786 (patch)
tree0faca74923dab4108541074695c5645d32104ca6 /exercises
parenta7e4c043999eb120f0b6be5a4e01793a02f1e676 (diff)
downloadziglings-bed01210e0fc2b3d84741c3a4731be73e1cec786.tar.gz
ziglings-bed01210e0fc2b3d84741c3a4731be73e1cec786.tar.bz2
ziglings-bed01210e0fc2b3d84741c3a4731be73e1cec786.tar.xz
ziglings-bed01210e0fc2b3d84741c3a4731be73e1cec786.zip
Normalized exercise output, answers (#41)
1. All exercises should print a trailing \n 2. The build script should always show you _exactly_ what it's looking for when you get it wrong. Therefore, .output should be set to the exact expected output.
Diffstat (limited to 'exercises')
-rw-r--r--exercises/022_errors2.zig2
-rw-r--r--exercises/023_errors3.zig2
-rw-r--r--exercises/024_errors4.zig2
-rw-r--r--exercises/025_errors5.zig2
-rw-r--r--exercises/036_enums2.zig1
-rw-r--r--exercises/037_structs.zig2
-rw-r--r--exercises/043_pointers5.zig2
7 files changed, 7 insertions, 6 deletions
diff --git a/exercises/022_errors2.zig b/exercises/022_errors2.zig
index 7bf00d4..1d513b3 100644
--- a/exercises/022_errors2.zig
+++ b/exercises/022_errors2.zig
@@ -25,5 +25,5 @@ pub fn main() void {
// an error. Can you set the type correctly above?
my_number = MyNumberError.TooSmall;
- std.debug.print("I compiled!", .{});
+ std.debug.print("I compiled!\n", .{});
}
diff --git a/exercises/023_errors3.zig b/exercises/023_errors3.zig
index a465737..81dd733 100644
--- a/exercises/023_errors3.zig
+++ b/exercises/023_errors3.zig
@@ -14,7 +14,7 @@ pub fn main() void {
var a: u32 = addTwenty(44) catch 22;
var b: u32 = addTwenty(4) ??? 22;
- std.debug.print("a={}, b={}", .{ a, b });
+ std.debug.print("a={}, b={}\n", .{ a, b });
}
// Please provide the return type from this function.
diff --git a/exercises/024_errors4.zig b/exercises/024_errors4.zig
index 7712f76..d45ab92 100644
--- a/exercises/024_errors4.zig
+++ b/exercises/024_errors4.zig
@@ -25,7 +25,7 @@ pub fn main() void {
var b: u32 = makeJustRight(14) catch 0;
var c: u32 = makeJustRight(4) catch 0;
- std.debug.print("a={}, b={}, c={}", .{ a, b, c });
+ std.debug.print("a={}, b={}, c={}\n", .{ a, b, c });
}
// In this silly example we've split the responsibility of making
diff --git a/exercises/025_errors5.zig b/exercises/025_errors5.zig
index 5119dcf..8739e4a 100644
--- a/exercises/025_errors5.zig
+++ b/exercises/025_errors5.zig
@@ -19,7 +19,7 @@ pub fn main() void {
var b: u32 = addFive(14) catch 0;
var c: u32 = addFive(4) catch 0;
- std.debug.print("a={}, b={}, c={}", .{ a, b, c });
+ std.debug.print("a={}, b={}, c={}\n", .{ a, b, c });
}
fn addFive(n: u32) MyNumberError!u32 {
diff --git a/exercises/036_enums2.zig b/exercises/036_enums2.zig
index 0ddc4a5..e6337e9 100644
--- a/exercises/036_enums2.zig
+++ b/exercises/036_enums2.zig
@@ -53,6 +53,7 @@ pub fn main() void {
\\ <span style="color: #{x:0>6}">Green</span>
\\ <span style="color: #{}">Blue</span>
\\</p>
+ \\
, .{
@enumToInt(Color.red),
@enumToInt(Color.green),
diff --git a/exercises/037_structs.zig b/exercises/037_structs.zig
index 8082248..7571c05 100644
--- a/exercises/037_structs.zig
+++ b/exercises/037_structs.zig
@@ -52,7 +52,7 @@ pub fn main() void {
// Ouch! Glorp takes a punch!
glorp_the_wise.health -= 10;
- std.debug.print("Your wizard has {} health and {} gold.", .{
+ std.debug.print("Your wizard has {} health and {} gold.\n", .{
glorp_the_wise.health,
glorp_the_wise.gold,
});
diff --git a/exercises/043_pointers5.zig b/exercises/043_pointers5.zig
index cb94189..ae80ecc 100644
--- a/exercises/043_pointers5.zig
+++ b/exercises/043_pointers5.zig
@@ -73,7 +73,7 @@ fn printCharacter(c: *Character) void {
.warrior => "Warrior",
};
- std.debug.print("{s} (G:{} H:{} XP:{})", .{
+ std.debug.print("{s} (G:{} H:{} XP:{})\n", .{
class_name,
c.gold,
c.health,