| 1 | package agi |
| 2 | |
| 3 | import ( |
| 4 | "testing" |
| 5 | |
| 6 | "github.com/stretchr/testify/assert" |
| 7 | ) |
| 8 | |
| 9 | func TestParseResponse(t *testing.T) { |
| 10 | for _, test := range []struct { |
| 11 | L string |
| 12 | R Response |
| 13 | }{ |
| 14 | {L: "200 result=1", R: Response{Status: 200, Result: 1, ResultString: "1"}}, |
| 15 | {L: "200 result=0 endpos=8640", R: Response{Status: 200, Result: 0, ResultString: "0", Value: "endpos=8640"}}, |
| 16 | } { |
| 17 | assert.Equal(t, &test.R, ParseResponse(test.L)) |
| 18 | } |
| 19 | } |