-
-
Notifications
You must be signed in to change notification settings - Fork 39
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
Add exponent tests for complex-numbers #64
base: main
Are you sure you want to change the base?
Add exponent tests for complex-numbers #64
Conversation
That happens when you don't use the "!" operator, to end a search point. |
@Average-user is that something we could test for? I'm not sure if it's possible, but it would be useful to look into. with regards to the actual content of the PR, the test logic isn't correct-- the first test with |
You should use =\=:
|
Well I mean more that, with a correct exponent function, X should equal 1 (ignoring floating point), but these tests assert that X doesn't equal 1 |
@Average-user I didn't even know that https://github.com/exercism/problem-specifications/blob/master/exercises/complex-numbers/canonical-data.json was a thing! I just came up with those test cases myself. I'll update the PR with those test cases. With regard to
I'm not sure what you're saying I should do. The first case is likely the one we want right? |
@Average-user @qjd2413 Updated with new tests. Let me know what you think. Still up to change to |
Oh wow. Well I feel stupid. I totally didn't realize that |
Okay, so the tests are actually testing things properly now, (although not exactly precisely, but up to three significant digits of precision). I don't love these tests (obviously infinitely better than before), but I couldn't find a good comparison operator that allowed for success when things were equal within some delta, so I basically wrote that myself. As a result, these tests aren't as readable as they might be, but they are correct. Let me know what you think @Average-user and @qjd2413 |
As you pointed out |
Now these tests actually test results properly.
f67f20c
to
beb898d
Compare
Could you create a
so the tests are easy to understand on first glance? |
@mbramson Are you interested in getting this PR over the line? |
The complex-numbers exercise instructs users to implement the exponent function in the README, but there are no tests for this function and no function stub. As a result, no users have yet implemented this function.
I added 5 tests for the exponent function as well as an exponent stub function to hopefully better direct users to complete the exercise.
Some commentary on the process of coming up with this solution. I ran into a few cases where I got the warning "test succeeded with choicepoint". This sent me down a rabbit hole or two which might lead some who are on the second exercise to get confused. That said, I'm 3 days into prolog at this point, and haven't done any of the later exercises, and so am not sure how the complexity will scale as I get further in. That might be just fine, or that might indicate that this function was too difficult for this exercise, I lack the perspective to say at this point.