Skip to content

fix bitwise.and and add tests - #19

Merged
Anand Krishnamoorthi (anakrish) merged 1 commit into
microsoft:mainfrom
eric-therond:fixbitwiseand
Jun 22, 2023
Merged

fix bitwise.and and add tests#19
Anand Krishnamoorthi (anakrish) merged 1 commit into
microsoft:mainfrom
eric-therond:fixbitwiseand

Conversation

@eric-therond

Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown
Collaborator

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.

Comment thread src/builtins/bitwise.rs
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
Copy Markdown
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
Copy Markdown
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 <eric.therond.fr@gmail.com>
@eric-therond

Copy link
Copy Markdown
Contributor Author

Just added more tests following your suggestion

Copy link
Copy Markdown
Collaborator

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!

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