aboutsummaryrefslogtreecommitdiffhomepage
path: root/model/entry_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'model/entry_test.go')
-rw-r--r--model/entry_test.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/model/entry_test.go b/model/entry_test.go
index 3f2e196..2f8c25d 100644
--- a/model/entry_test.go
+++ b/model/entry_test.go
@@ -42,6 +42,20 @@ func TestValidateEntryDirection(t *testing.T) {
}
}
+func TestValidateRange(t *testing.T) {
+ if err := ValidateRange(-1, 0); err == nil {
+ t.Error(`An invalid offset should generate a error`)
+ }
+
+ if err := ValidateRange(0, -1); err == nil {
+ t.Error(`An invalid limit should generate a error`)
+ }
+
+ if err := ValidateRange(42, 42); err != nil {
+ t.Error(`A valid offset and limit should not generate any error`)
+ }
+}
+
func TestGetOppositeDirection(t *testing.T) {
if GetOppositeDirection("asc") != "desc" {
t.Errorf(`The opposite direction of "asc" should be "desc"`)