Skip to content
Permalink
Browse files

Just adding a test for good conscience

  • Loading branch information...
Depado committed Feb 14, 2016
1 parent 92654ca commit c2c49f7b33e09126402e4d3ea6b45e82013a5bf3
Showing with 25 additions and 0 deletions.
  1. +25 −0 plugins/trade/options_test.go
@@ -0,0 +1,25 @@
package trade

import (
"reflect"
"strings"
"testing"
)

func TestParseOptions(t *testing.T) {
payloads := map[string]options{
"btc eth": {false, false, "btc", "eth", 1, ""},
"2 btc eth": {false, false, "btc", "eth", 2, ""},
"btc eth --market=kraken": {false, false, "btc", "eth", 1, "kraken"},
"2 btc eth --market=kraken": {false, false, "btc", "eth", 2, "kraken"},
"eth btc --market=all": {false, false, "eth", "btc", 1, "all"},
"eth btc --sort=price": {true, false, "eth", "btc", 1, ""},
}

for in, expected := range payloads {
got, _ := parseOptions(strings.Split(in, " "))
if !reflect.DeepEqual(got, expected) {
t.Errorf("Expected %+v, got %+v", expected, got)
}
}
}

0 comments on commit c2c49f7

Please sign in to comment.
You can’t perform that action at this time.