Skip to content

Commit

Permalink
Add simple python tests for flamegpu::detail::JitifyCache
Browse files Browse the repository at this point in the history
  • Loading branch information
ptheywood committed Nov 21, 2023
1 parent 852d432 commit afc1a14
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/python/detail/test_jitify_cache.py
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

0 comments on commit afc1a14

Please sign in to comment.