summaryrefslogtreecommitdiff
path: root/settings_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'settings_test.go')
-rw-r--r--settings_test.go33
1 files changed, 33 insertions, 0 deletions
diff --git a/settings_test.go b/settings_test.go
index 3a4ce0a..4e45567 100644
--- a/settings_test.go
+++ b/settings_test.go
@@ -48,3 +48,36 @@ func TestMmapSizes(t *testing.T) {
t.Fatal("Sizes don't match")
}
}
+
+func TestEnableCaching(t *testing.T) {
+ err := EnableCaching(false)
+ checkFatal(t, err)
+
+ err = EnableCaching(true)
+ checkFatal(t, err)
+}
+
+func TestGetCachedMemory(t *testing.T) {
+ current, allowed, err := GetCachedMemory()
+ checkFatal(t, err)
+
+ if current < 0 {
+ t.Fatal("current < 0")
+ }
+
+ if allowed < 0 {
+ t.Fatal("allowed < 0")
+ }
+}
+
+func TestSetCacheMaxSize(t *testing.T) {
+ err := SetCacheMaxSize(0)
+ checkFatal(t, err)
+
+ err = SetCacheMaxSize(1024 * 1024)
+ checkFatal(t, err)
+
+ // revert to default 256MB
+ err = SetCacheMaxSize(256 * 1024 * 1024)
+ checkFatal(t, err)
+} \ No newline at end of file