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

fix bitwise.and and add tests #19

Merged
merged 1 commit into from
Jun 22, 2023
Merged

Conversation

eric-therond
Copy link
Contributor

No description provided.

Copy link
Collaborator

@anakrish anakrish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for your contribution!

To make it complete, we would need tests for the following cases:

  1. Less number of arguments than expected
  2. More number of arguments than expected
  3. Wrong type for argument at each position.

If the tests become large, we could split the files to bitwise/and.yaml, bitwise/lsh.yaml etc.

@@ -14,7 +14,7 @@ use anyhow::Result;

pub fn register(m: &mut HashMap<&'static str, builtins::BuiltinFcn>) {
m.insert("bits.and", and);
m.insert("bits.and", lsh);
m.insert("bits.lsh", lsh);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

- |
package test

x = bits.and(1, "str")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also lock down with a test for and(string, number) as well as with more than two parameters.

Signed-off-by: eric-therond <[email protected]>
@eric-therond
Copy link
Contributor Author

Just added more tests following your suggestion

Copy link
Collaborator

@anakrish anakrish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Thanks for your contribution!

@anakrish anakrish merged commit e08d13d into microsoft:main Jun 22, 2023
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