-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b53839c
commit fc9e474
Showing
4 changed files
with
42 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,48 @@ | ||
package validator | ||
|
||
import "testing" | ||
import ( | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
) | ||
|
||
func TestIs(t *testing.T) { | ||
if !Is("[email protected]", "required,email") { | ||
t.Error("Expected true, got false") | ||
} | ||
assert.True(t, Is("[email protected]", "required,email")) | ||
} | ||
|
||
func TestInSlice(t *testing.T) { | ||
if !InSlice("ABC", []string{"ABC", "DEF"}) { | ||
t.Error("Expected true, got false") | ||
} | ||
|
||
if InSlice("NOO", []string{"ABC", "DEF"}) { | ||
t.Error("Expected false, got true") | ||
} | ||
assert.True(t, InSlice("ABC", []string{"ABC", "DEF"})) | ||
assert.False(t, InSlice("NOO", []string{"ABC", "DEF"})) | ||
} | ||
|
||
func TestIsExchange(t *testing.T) { | ||
if !IsExchange("binance") { | ||
t.Error("Expected true, got false") | ||
} | ||
assert.True(t, IsExchange("binance")) | ||
} | ||
|
||
func TestIsExchangeWith(t *testing.T) { | ||
if !IsExchangeWith("myexchange", []string{"myexchange"}) { | ||
t.Error("Expected true, got false") | ||
} | ||
assert.True(t, IsExchangeWith("myexchange", []string{"myexchange"})) | ||
} | ||
|
||
func TestIsExchangeWithInit(t *testing.T) { | ||
InitExchangeList([]string{"ownexchange"}) | ||
if !IsExchange("ownexchange") { | ||
t.Error("Expected true, got false") | ||
} | ||
assert.True(t, IsExchange("ownexchange")) | ||
} | ||
|
||
func TestIsSymbol(t *testing.T) { | ||
if !IsSymbol("BTC/USDT") { | ||
t.Error("Expected true, got false") | ||
} | ||
assert.True(t, IsSymbol("BTC/USDT")) | ||
} | ||
|
||
func TestIsSymbolWith(t *testing.T) { | ||
if !IsSymbolWith("BTC-USDT", "-") { | ||
t.Error("Expected true, got false") | ||
} | ||
assert.True(t, IsSymbolWith("BTC-USDT", "-")) | ||
} | ||
|
||
func TestIsBuyerMakerStr(t *testing.T) { | ||
if !IsBuyerMaker("buy") { | ||
t.Error("Expected true, got false") | ||
} | ||
assert.True(t, IsBuyerMaker("buy")) | ||
} | ||
|
||
func TestIsBuyerMakerOC(t *testing.T) { | ||
if !IsBuyerMakerOC(2.0, 3.0) { | ||
t.Error("Expected true, got false") | ||
} | ||
assert.True(t, IsBuyerMakerOC(2.0, 3.0)) | ||
} | ||
|
||
func TestIsEmpty(t *testing.T) { | ||
if !IsEmpty(" ") { | ||
t.Error("Expected true, got false") | ||
} | ||
assert.True(t, IsEmpty(" ")) | ||
} |