Skip to content
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

Update test_parser.py #139

Closed
wants to merge 2 commits into from
Closed

Update test_parser.py #139

wants to merge 2 commits into from

Conversation

Sambit712
Copy link

@Sambit712 Sambit712 commented Sep 5, 2024

1.Anticipated AST:

A. For the condition "(a > 1)," the test anticipates a "IfNode" with a "BinaryOpNode," followed by a body that includes the "doSomething()" function call (represented as a "FunctionCallNode"). B. The else if block is handled recursively as an additional "IfNode," including a function call ( "doSomethingElse()") and its own condition "(a < 0)". C. The function call for "fallback()" is contained in the else block.

  1. Assistance Nodes:

A. To compare nodes in the test, the "IfNode," "BinaryOpNode," "VariableNode," and "FunctionCallNode" classes are defined with "eq" methods. B. The structure that your parser outputs must match these nodes.

  1. FunctionCallNode:

This node symbolises a call to a function, such as "fallback()" or "doSomething()." If your parser generates a different structure for function calls, you should modify this node definition.

Make that the 'IfNode,' 'BinaryOpNode,' and 'VariableNode' are generated appropriately and that your 'GLSLParser' can construct 'FunctionCallNode' objects for function calls.

After you're satisfied the parser is operating correctly run the test using: python -m unittest test_glsl_parser.py

PR Description

Related Issue

shader Sample

Checklist

  • Have you added the necessary tests?
  • Only modified the files mentioned in the related issue(s)?
  • Are all tests passing?

1.Anticipated AST:

A. For the condition "(a > 1)," the test anticipates a "IfNode" with a "BinaryOpNode," followed by a body that includes the "doSomething()" function call (represented as a "FunctionCallNode").
B. The else if block is handled recursively as an additional "IfNode," including a function call ( "doSomethingElse()") and its own condition "(a < 0)".
C. The function call for "fallback()" is contained in the else block.

2. Assistance Nodes:

A. To compare nodes in the test, the "IfNode," "BinaryOpNode," "VariableNode," and "FunctionCallNode" classes are defined with "__eq__" methods.
B. The structure that your parser outputs must match these nodes.

3. FunctionCallNode: 

This node symbolises a call to a function, such as "fallback()" or "doSomething()." If your parser generates a different structure for function calls, you should modify this node definition.

Make that the 'IfNode,' 'BinaryOpNode,' and 'VariableNode' are generated appropriately and that your 'GLSLParser' can construct 'FunctionCallNode' objects for function calls.

After you're satisfied the parser is operating correctly run the test using:
python -m unittest test_glsl_parser.py
@samthakur587
Copy link
Contributor

hii @Sambit712 it's great that you have worked on this but as of now we are do not adding the assert for all node in parser bcz it is too complicated to write assert for each node. currently there are short test example but if you write a complete code for a shader than it has so many nodes in ast writing assert for each node is very difficult.

we have a different pipeline that check that example in more detail in developing stage. we are not doing the way you write this .

@samthakur587
Copy link
Contributor

you can checkout this #89 todo list and assign yourself a task that you feel confident and start working on it .

@Sambit712
Copy link
Author

Sambit712 commented Sep 6, 2024 via email

@samthakur587
Copy link
Contributor

samthakur587 commented Sep 6, 2024

hii @Sambit712 if you go through this merged PR #104 then you will understand how to add the tests not like you added . and make a single PR so i can understand what you are working on .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants