-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests #7
base: master
Are you sure you want to change the base?
Add tests #7
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rough thoughts on the current stuff
I like the idea of hosting simple tests from our own C files. Depending on how many tests there ends up being it would be nice to split each test into it's own python file, but this is fine for now. test.py
in root can probably also go.
Three small nits
@@ -0,0 +1 @@ | |||
#include "../libgfxd/gbi.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could an include path for libgfxd be specified in the makefile rather than this dummy file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea with this wrapper .h would also be to let someone try another gbi.h, since libgfxd's is glank's i.e. not sgi's / decomp's
But yeah this can be changed idk
subrepo: subdir: "libgfxd" merged: "7dd7fa1" upstream: origin: "https://github.com/glankk/libgfxd" branch: "master" commit: "7dd7fa1" git-subrepo: version: "0.4.5" origin: "git@github.com:ingydotnet/git-subrepo.git" commit: "dbb99be"
libgfxd 7dd7fa16227f6d4c336abfda353d01f833334413 Update/add `gfxd_light_callback`, `gfxd_lightsn_callback` Add binding for `gfxd_foreach_pkt` Update description for `gfxd_macro_fn`
gfxd_target(gfxd_f3dex2) | ||
gfxd_endian(GfxdEndian.big, 4) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about putting this everywhere 🤷
Probably deal with it if/when someone uses something other than the Superior ™️ Ucode f3dzex
test/test.py
Outdated
try: | ||
gfxd_vtx_callback(callback) | ||
|
||
gfxd_execute() | ||
finally: | ||
def callback(vtx, num): | ||
return 0 | ||
gfxd_vtx_callback(callback) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this (try: ... finally: clear callback) is kind of bad I think, tests need to clear the state or it will mess with other states since libgfxd "keeps running"/is the same instance
Not sure what to do about it. "As long as it works" though is imo fine for tests
I only spotted this issue from adding this vtx callback test case, I should probably go over other callbacks and do the same
Also gfxd_vtx_callback(None)
should eventually be made to work as you'd expect (afaict there currently is no way to unset a callback)
def callback(bufP, count): | ||
newdata = remaining_data[0][:count] | ||
from ctypes import c_char | ||
|
||
buftype = c_char * len(newdata) | ||
buf = buftype.from_address(bufP) | ||
buf[: len(newdata)] = newdata | ||
remaining_data[0] = remaining_data[0][len(newdata) :] | ||
return len(newdata) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
note: this could be improved on the pygfxd wrapper side
…is stored... of course...
Start adding tests
The current "test" stuff: