/
test_resistor_color_duo.zig
47 lines (40 loc) · 1.42 KB
/
test_resistor_color_duo.zig
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
46
47
const std = @import("std");
const testing = std.testing;
const resistor_color_duo = @import("resistor_color_duo.zig");
const ColorBand = resistor_color_duo.ColorBand;
test "brown and black" {
const array = [_]ColorBand{ .brown, .black };
const expected: usize = 10;
const actual = resistor_color_duo.colorCode(array);
try testing.expectEqual(expected, actual);
}
test "blue and grey" {
const array = [_]ColorBand{ .blue, .grey };
const expected: usize = 68;
const actual = resistor_color_duo.colorCode(array);
try testing.expectEqual(expected, actual);
}
test "yellow and violet" {
const array = [_]ColorBand{ .yellow, .violet };
const expected: usize = 47;
const actual = resistor_color_duo.colorCode(array);
try testing.expectEqual(expected, actual);
}
test "white and red" {
const array = [_]ColorBand{ .white, .red };
const expected: usize = 92;
const actual = resistor_color_duo.colorCode(array);
try testing.expectEqual(expected, actual);
}
test "orange and orange" {
const array = [_]ColorBand{ .orange, .orange };
const expected: usize = 33;
const actual = resistor_color_duo.colorCode(array);
try testing.expectEqual(expected, actual);
}
test "black and brown, one-digit" {
const array = [_]ColorBand{ .black, .brown };
const expected: usize = 1;
const actual = resistor_color_duo.colorCode(array);
try testing.expectEqual(expected, actual);
}