day20: whelp.

This commit is contained in:
efim
2023-12-20 11:14:45 +00:00
parent 1e32ec0988
commit 57fdfb01cb
6 changed files with 272 additions and 17 deletions

View File

@@ -10,7 +10,7 @@ func TestPropagateButtonPressExample1(t *testing.T) {
modules := ReadModules(filename)
t.Log("got modules:\n", modules)
low, high := PropagateButtonPress(modules)
low, high := PropagateButtonPress(modules, 0)
t.Logf("got low %d and high %d\n", low, high)
t.Log("modules after single button press:\n", modules)
@@ -26,7 +26,7 @@ func TestPropagateButtonPressExample2(t *testing.T) {
t.Log("got modules:\n", modules)
InitStuffs(modules)
low, high := PropagateButtonPress(modules)
low, high := PropagateButtonPress(modules, 0)
t.Logf("got low %d and high %d\n", low, high)
t.Log("modules after single button press:\n", modules)
@@ -44,7 +44,7 @@ func TestPropagateButtonPressExample2FourSteps(t *testing.T) {
initialModulesState := ModulesState(modules)
low, high := PropagateButtonPress(modules)
low, high := PropagateButtonPress(modules, 0)
t.Logf("got low %d and high %d\n", low, high)
t.Log("#1 button press:\n", modules)
success := low == 4 && high == 4
@@ -52,7 +52,7 @@ func TestPropagateButtonPressExample2FourSteps(t *testing.T) {
t.Errorf("expected low 4 got %d, high 4 got %d", low, high)
}
low, high = PropagateButtonPress(modules)
low, high = PropagateButtonPress(modules, 0)
t.Logf("got low %d and high %d\n", low, high)
t.Log("#2 button press:\n", modules)
success = low == 4 && high == 2
@@ -64,7 +64,7 @@ func TestPropagateButtonPressExample2FourSteps(t *testing.T) {
t.Error("initial state should be different from second")
}
low, high = PropagateButtonPress(modules)
low, high = PropagateButtonPress(modules, 0)
t.Logf("got low %d and high %d\n", low, high)
t.Log("#3 button press:\n", modules)
success = low == 5 && high == 3
@@ -76,7 +76,7 @@ func TestPropagateButtonPressExample2FourSteps(t *testing.T) {
t.Error("initial state should be different from third")
}
low, high = PropagateButtonPress(modules)
low, high = PropagateButtonPress(modules, 0)
t.Logf("got low %d and high %d\n", low, high)
t.Log("#4 button press:\n", modules)
success = low == 4 && high == 2