-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ajustando novas regras de validacao para o estado de Goias
- Loading branch information
1 parent
651a194
commit 6bb99ca
Showing
4 changed files
with
83 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package validators | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestRuleIsStartBetweenNotOk(t *testing.T) { | ||
|
||
rule := NewRule() | ||
|
||
result := rule.IsStartBetween("0100482300112", "20", "30") | ||
assert.False(t, result) | ||
} | ||
|
||
func TestRuleIsStartBetweenOk(t *testing.T) { | ||
|
||
rule := NewRule() | ||
|
||
result := rule.IsStartBetween("2100482300112", "20", "30") | ||
assert.True(t, result) | ||
|
||
result = rule.IsStartBetween("0200482300112", "01", "03") | ||
assert.True(t, result) | ||
|
||
result = rule.IsStartBetween("0300482300112", "01", "03") | ||
assert.True(t, result) | ||
} | ||
|
||
func TestRuleIsStartBetweenWithInvalidValues(t *testing.T) { | ||
|
||
rule := NewRule() | ||
|
||
result := rule.IsStartBetween("2100482300112", "", "30") | ||
assert.False(t, result) | ||
|
||
result = rule.IsStartBetween("2100482300112", "40", "30") | ||
assert.False(t, result) | ||
|
||
result = rule.IsStartBetween("2100482300112", "P-", "30") | ||
assert.False(t, result) | ||
} |