Compare commits
1 Commits
284c2b923a
...
cb2b6087b7
Author | SHA1 | Date | |
---|---|---|---|
cb2b6087b7 |
@ -29,7 +29,7 @@ func run(scan *bufio.Scanner) (*result, error) {
|
||||
}
|
||||
dist := m.buildPath()
|
||||
|
||||
|
||||
|
||||
|
||||
return &result{valuePT1: dist}, nil
|
||||
}
|
||||
@ -75,19 +75,19 @@ func (m *Path) readLine(text string) {
|
||||
}
|
||||
func (m *Path) buildPath() int {
|
||||
m.start()
|
||||
log(m.n)
|
||||
// log(m.n)
|
||||
i := 0
|
||||
for m.next() {
|
||||
log(m.n)
|
||||
// log(m.n)
|
||||
i++
|
||||
}
|
||||
log(m.n)
|
||||
log("length", (m.l+2)/2)
|
||||
// log(m.n)
|
||||
// log("length", (m.l+2)/2)
|
||||
return (m.l+2)/2
|
||||
}
|
||||
func (m *Path) start() {
|
||||
m.n = &node{value: 'S', pos: m.s}
|
||||
log(m.n)
|
||||
// log(m.n)
|
||||
|
||||
switch {
|
||||
case m.peek(UP) != nil:
|
||||
|
@ -34,11 +34,8 @@ func TestExample1(t *testing.T) {
|
||||
result, err := run(scan)
|
||||
is.NoErr(err)
|
||||
|
||||
t.Log(result.valuePT1)
|
||||
// t.Log(result.valuePT1)
|
||||
is.Equal(result.valuePT1, 4)
|
||||
|
||||
t.Log(result.valuePT2)
|
||||
is.Equal(result.valuePT2, uint64(0))
|
||||
}
|
||||
|
||||
func TestExample2(t *testing.T) {
|
||||
@ -48,11 +45,8 @@ func TestExample2(t *testing.T) {
|
||||
result, err := run(scan)
|
||||
is.NoErr(err)
|
||||
|
||||
t.Log(result.valuePT1)
|
||||
// t.Log(result.valuePT1)
|
||||
is.Equal(result.valuePT1, 8)
|
||||
|
||||
t.Log(result.valuePT2)
|
||||
is.Equal(result.valuePT2, uint64(0))
|
||||
}
|
||||
|
||||
func TestExample3(t *testing.T) {
|
||||
@ -62,10 +56,10 @@ func TestExample3(t *testing.T) {
|
||||
result, err := run(scan)
|
||||
is.NoErr(err)
|
||||
|
||||
t.Log(result.valuePT1)
|
||||
// t.Log(result.valuePT1)
|
||||
is.Equal(result.valuePT1, 23)
|
||||
|
||||
t.Log(result.valuePT2)
|
||||
// t.Log(result.valuePT2)
|
||||
is.Equal(result.valuePT2, 4)
|
||||
}
|
||||
|
||||
@ -76,10 +70,10 @@ func TestExample4(t *testing.T) {
|
||||
result, err := run(scan)
|
||||
is.NoErr(err)
|
||||
|
||||
t.Log(result.valuePT1)
|
||||
// t.Log(result.valuePT1)
|
||||
is.Equal(result.valuePT1, 70)
|
||||
|
||||
t.Log(result.valuePT2)
|
||||
// t.Log(result.valuePT2)
|
||||
is.Equal(result.valuePT2, 8)
|
||||
}
|
||||
|
||||
@ -90,10 +84,10 @@ func TestExample5(t *testing.T) {
|
||||
result, err := run(scan)
|
||||
is.NoErr(err)
|
||||
|
||||
t.Log(result.valuePT1)
|
||||
// t.Log(result.valuePT1)
|
||||
is.Equal(result.valuePT1, 80)
|
||||
|
||||
t.Log(result.valuePT2)
|
||||
// t.Log(result.valuePT2)
|
||||
is.Equal(result.valuePT2, 10)
|
||||
}
|
||||
|
||||
@ -104,12 +98,12 @@ func TestInput(t *testing.T) {
|
||||
result, err := run(scan)
|
||||
is.NoErr(err)
|
||||
|
||||
t.Log(result.valuePT1)
|
||||
t.Log(result.valuePT1 != 51)
|
||||
// t.Log(result.valuePT1)
|
||||
is.True(result.valuePT1 != 51)
|
||||
is.Equal(result.valuePT1, 6649)
|
||||
|
||||
t.Log(result.valuePT2)
|
||||
is.Equal(result.valuePT2, uint64(0))
|
||||
// t.Log(result.valuePT2)
|
||||
is.True(result.valuePT2 != 0)
|
||||
}
|
||||
|
||||
// first: 51 false
|
||||
|
Loading…
x
Reference in New Issue
Block a user