-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple python tests for flamegpu::detail::JitifyCache
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import pytest | ||
from unittest import TestCase | ||
from pyflamegpu import * | ||
|
||
class JitifyCacheTest(TestCase): | ||
""" | ||
Test the now exposed flamegpu::detail::JitifyCache methods are exposed to python | ||
This does not test the clear*cache methods, as that would have grim side-effects | ||
""" | ||
def test_memorycache(self): | ||
""" | ||
Test setting and checking the state of the jitify memory cache | ||
""" | ||
rtc_cache = pyflamegpu.JitifyCache.getInstance() | ||
originally_enabled = rtc_cache.useMemoryCache() | ||
rtc_cache.useMemoryCache(True) | ||
assert rtc_cache.useMemoryCache() == True | ||
rtc_cache.useMemoryCache(False) | ||
assert rtc_cache.useMemoryCache() == False | ||
rtc_cache.useMemoryCache(originally_enabled) | ||
assert rtc_cache.useMemoryCache() == originally_enabled | ||
|
||
def test_diskcache(self): | ||
""" | ||
Test setting and checking the state of the jitify disk cache | ||
""" | ||
rtc_cache = pyflamegpu.JitifyCache.getInstance() | ||
originally_enabled = rtc_cache.useDiskCache() | ||
rtc_cache.useDiskCache(True) | ||
assert rtc_cache.useDiskCache() == True | ||
rtc_cache.useDiskCache(False) | ||
assert rtc_cache.useDiskCache() == False | ||
rtc_cache.useDiskCache(originally_enabled) | ||
assert rtc_cache.useDiskCache() == originally_enabled |