Skip to content

Commit

Permalink
add support for unsigned integer at opengl backend (#246)
Browse files Browse the repository at this point in the history
Co-authored-by: Nripesh Niketan <[email protected]>
  • Loading branch information
themaverick and NripeshN authored Jan 3, 2025
1 parent a83549c commit 5db64c9
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_backend/test_opengl/test_codegen.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,5 +204,24 @@ def test_double_dtype_codegen():
pytest.fail("double tokenization not implemented")


def test_unsigned_int_dtype_codegen():
code = """
double ComputeArea(double radius) {
uint a = 3;
uint b = 4;
uint ans = a + b;
return ans;
}
"""
try:
tokens = tokenize_code(code)
ast = parse_code(tokens)
code = generate_code(ast)
print(code)
except SyntaxError:
pytest.fail("unsigned integer tokenization not implemented.")


if __name__ == "__main__":
pytest.main()
16 changes: 16 additions & 0 deletions tests/test_backend/test_opengl/test_lexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,5 +139,21 @@ def test_mod_tokenization():
assert has_mod, "Modulus operator (%) not tokenized correctly"


def test_unsigned_int_dtype_tokenization():
code = """
double ComputeArea(double radius) {
uint a = 3;
uint b = 4;
uint ans = a + b;
return ans;
}
"""
try:
tokenize_code(code)
except SyntaxError:
pytest.fail("unsigned integer parsing not implemented.")


if __name__ == "__main__":
pytest.main()
16 changes: 16 additions & 0 deletions tests/test_backend/test_opengl/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,5 +210,21 @@ def test_mod_parsing():
pytest.fail("Modulus operator parsing not implemented")


def test_unsigned_int_dtype_tokenization():
code = """
double ComputeArea(double radius) {
uint a = 3;
uint b = 4;
uint ans = a + b;
return ans;
}
"""
try:
tokenize_code(code)
except SyntaxError:
pytest.fail("unsigned integer parsing not implemented.")


if __name__ == "__main__":
pytest.main()

0 comments on commit 5db64c9

Please sign in to comment.