51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package utility
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestValidXLXSDate(t *testing.T) {
|
|
const date = "40179.0"
|
|
dateValidator := &XLXSDateValidator{date}
|
|
expVal := true
|
|
actVal := ValidateData(dateValidator)
|
|
|
|
if actVal != expVal {
|
|
t.Errorf("Failed:%s with expected value:%t and actual value:%t\n", date, expVal, actVal)
|
|
}
|
|
}
|
|
|
|
func TestInvalidXLXSDate(t *testing.T) {
|
|
const date = "dsds"
|
|
dateValidator := &XLXSDateValidator{date}
|
|
expVal := false
|
|
actVal := ValidateData(dateValidator)
|
|
|
|
if actVal != expVal {
|
|
t.Errorf("Failed:%s with expected value:%t and actual value:%t\n", date, expVal, actVal)
|
|
}
|
|
}
|
|
|
|
|
|
func TestValidCurrencyAmount(t *testing.T) {
|
|
const currencyAmount = "1,728.30"
|
|
currencyAmountValidator := &CurrencyAmountValidator{currencyAmount}
|
|
expVal := true
|
|
actVal := ValidateData(currencyAmountValidator)
|
|
|
|
if actVal != expVal {
|
|
t.Errorf("Failed:%s with expected value:%t and actual value:%t\n", currencyAmount, expVal, actVal)
|
|
}
|
|
}
|
|
|
|
func TestInValidCurrencyAmount(t *testing.T) {
|
|
const currencyAmount = "ddd333"
|
|
currencyAmountValidator := &CurrencyAmountValidator{currencyAmount}
|
|
expVal := false
|
|
actVal := ValidateData(currencyAmountValidator)
|
|
|
|
if actVal != expVal {
|
|
t.Errorf("Failed:%s with expected value:%t and actual value:%t\n", currencyAmount, expVal, actVal)
|
|
}
|
|
}
|