day 16
This commit is contained in:
parent
cccd9976df
commit
ad8b760cb2
2 changed files with 178 additions and 0 deletions
37
16/16_test.go
Normal file
37
16/16_test.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
var test = []string{"s1", "x3/4", "pe/b"}
|
||||
|
||||
func TestRun16(t *testing.T) {
|
||||
i := ParseInstr(test)
|
||||
input := "abcde"
|
||||
v := Run16(input, i)
|
||||
if v != "baedc" {
|
||||
t.Error(
|
||||
"For", test,
|
||||
"expected baedc",
|
||||
"got", v,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRun1M(t *testing.T) {
|
||||
i := ParseInstr(test)
|
||||
input := "abcdefghijlmnop"
|
||||
|
||||
for x :=0; x<10000000; x++ {
|
||||
input = Run16(input, i)
|
||||
}
|
||||
|
||||
if input != "fghdijlmnopabce" {
|
||||
t.Error(
|
||||
"For", test,
|
||||
"expected fghdijlmnopabce",
|
||||
"got", input,
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue