day20: more reading
This commit is contained in:
@@ -16,7 +16,7 @@ func TestParseFlipFlop(t *testing.T) {
|
||||
|
||||
func TestParseBroadcast(t *testing.T) {
|
||||
broadcastLine := "broadcaster -> a, b, c"
|
||||
if !isLineBroadcast(broadcastLine) {
|
||||
if !IsLineBroadcast(broadcastLine) {
|
||||
t.Error("expected line to pass broadcast check")
|
||||
}
|
||||
module := ParseBroadcast(broadcastLine)
|
||||
@@ -29,16 +29,24 @@ func TestParseBroadcast(t *testing.T) {
|
||||
|
||||
func TestParseConjunction(t *testing.T) {
|
||||
conjunctionLine := "&inv -> b"
|
||||
if !isLineConjunction(conjunctionLine) {
|
||||
if !IsLineConjunction(conjunctionLine) {
|
||||
t.Errorf("line '%s' should be flip flop\n", conjunctionLine)
|
||||
}
|
||||
module := ParseConjunction(conjunctionLine)
|
||||
t.Logf("got module %+v\n", module)
|
||||
if module.Name != "inv" || slices.Equal(module.OutputNames, []string{"b"}) {
|
||||
moduleAsExpected := module.Name != "inv" || slices.Equal(module.OutputNames, []string{"b"})
|
||||
if !moduleAsExpected {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func TestPanic(t *testing.T) {
|
||||
panic("hehe")
|
||||
func TestReadManyModules(t *testing.T) {
|
||||
filename := "example1"
|
||||
modules := ReadModules(filename)
|
||||
t.Logf("> read example1:\n%+v", modules)
|
||||
|
||||
filename2 := "example2"
|
||||
modules2 := ReadModules(filename2)
|
||||
t.Logf("> read example2:\n%+v", modules2)
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user