-
Notifications
You must be signed in to change notification settings - Fork 29
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
A prototype for solve dividing two integers #66
Open
r888800009
wants to merge
8
commits into
MatthieuDartiailh:main
Choose a base branch
from
r888800009:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a97fc32
Add tastecase for integer
r888800009 6617969
Add more test case
r888800009 d02ee92
Add More division test cases
r888800009 f5f8bf8
Proof of concept for c division
r888800009 44daba6
Support for octal numbers and add tests
r888800009 a7f7624
Use int() instead of eval() for security
r888800009 8e7eed1
coding style fixed
r888800009 a946a50
make sure wrap_int() return CInt instance
r888800009 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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 | ||||
---|---|---|---|---|---|---|
|
@@ -290,6 +290,17 @@ def test_values(self): | |||||
macros['MACRO_H3'] == '0X000002UL' and | ||||||
values['MACRO_H3'] == 2) | ||||||
|
||||||
# Octal integer | ||||||
assert ('MACRO_OCT1' in macros and | ||||||
macros['MACRO_OCT1'] == '+ 010' and | ||||||
values['MACRO_OCT1'] == 0o10) | ||||||
assert ('MACRO_OCT2' in macros and | ||||||
macros['MACRO_OCT2'] == '-03000U' and | ||||||
values['MACRO_OCT2'] == -0o3000) | ||||||
assert ('MACRO_OCT3' in macros and | ||||||
macros['MACRO_OCT3'] == '02UL' and | ||||||
values['MACRO_OCT3'] == 0o2) | ||||||
|
||||||
# Bit shifted hexadecimal integer | ||||||
assert ('MACRO_SH1' in macros and | ||||||
macros['MACRO_SH1'] == '(0x000000 << 1)' and | ||||||
|
@@ -566,6 +577,24 @@ def test_variables(self): | |||||
assert ('x2' in variables and | ||||||
variables['x2'] == (88342528, Type('int'))) | ||||||
|
||||||
# Test int div 9 / 2 should be 4 | ||||||
assert ('x3' in variables and | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
the indexing will anyway if the key does not exist in the dict. No need to test it separately. |
||||||
variables['x3'] == (4.5, Type('float'))) | ||||||
assert ('x4' in variables and | ||||||
variables['x4'] == (4, Type('int'))) | ||||||
assert ('x5' in variables and | ||||||
variables['x5'] == (4., Type('float'))) | ||||||
assert ('x6' in variables and | ||||||
variables['x6'] == (4., Type('float'))) | ||||||
assert ('x7' in variables and | ||||||
variables['x7'] == (4.5, Type('float'))) | ||||||
assert ('x8' in variables and | ||||||
variables['x8'] == (9., Type('float'))) | ||||||
assert ('x9' in variables and | ||||||
variables['x9'] == (-4, Type('int'))) | ||||||
assert ('x10' in variables and | ||||||
variables['x10'] == (-1, Type('int'))) | ||||||
|
||||||
# Test array handling | ||||||
assert ('array' in variables and | ||||||
variables['array'] == ([1, 3141500.0], Type('float', [2]))) | ||||||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
great tests!