Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Add pow builtin #373

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Add pow builtin #373

wants to merge 1 commit into from

Conversation

aisk
Copy link
Contributor

@aisk aisk commented Jul 30, 2017

No description provided.

Copy link
Contributor

@trotterdylan trotterdylan left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Just a couple small suggestions.

if raised := checkFunctionArgs(f, "pow", args, expectedTypes...); raised != nil {
return nil, raised
}
v := args[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you just call return Pow(f, args[0], args[1]) instead?

@@ -294,6 +294,8 @@ func TestBuiltinFuncs(t *testing.T) {
{f: "ord", args: wrapArgs("foo"), wantExc: mustCreateException(ValueErrorType, "ord() expected a character, but string of length 3 found")},
{f: "ord", args: wrapArgs(NewUnicode("волн")), wantExc: mustCreateException(ValueErrorType, "ord() expected a character, but string of length 4 found")},
{f: "ord", args: wrapArgs(1, 2, 3), wantExc: mustCreateException(TypeErrorType, "'ord' requires 1 arguments")},
{f: "pow", args: wrapArgs(1), wantExc: mustCreateException(TypeErrorType, "'pow' requires 2 arguments")},
Copy link
Contributor

Choose a reason for hiding this comment

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

Would be nice to have a couple more test cases, e.g. a negative exponent and a complex number

@aisk
Copy link
Contributor Author

aisk commented Sep 7, 2017

@trotterdylan Ready for review!

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

Successfully merging this pull request may close these issues.

2 participants