rs-basic/members/revsqrt/tests/features/book/revsqrt.feature

126 lines
3.6 KiB
Gherkin
Raw Normal View History

2024-01-15 16:29:55 +01:00
Feature: inverted square root calculation
2024-01-12 14:45:00 +01:00
2024-01-15 16:29:55 +01:00
Scenario: Calculate fast inverted sqrt
2024-01-12 14:45:00 +01:00
Given a number
2024-01-15 16:29:55 +01:00
When we calculate the inverted square root of it using the fast inverted square root algorithm
Then the result is about the same as if we calculate it normally
Scenario: Calculate regular inverted sqrt
Given a number
When we calculate the inverted square root of it normally
Then the result can be calculated
Scenario: Can the fast inverted sqrt be calculated?
Given a number
When we calculate the inverted square root of it using the fast inverted square root algorithm
Then the result can be calculated
Scenario: Can the regular inverted sqrt be calculated?
Given a number
When we calculate the inverted square root of it normally
Then the result can be calculated
Scenario: Calculate fast inverted sqrt with specific numbers
Given the number n
| n |
| 1 |
| 1.1 |
| 100 |
| 1337 |
| 123.45678900 |
| 1337.1337 |
When we calculate the inverted square root of it using the fast inverted square root algorithm
Then the result is about the same as m
| m |
| 1 |
| 0.9534625892455922 |
| 0.1 |
| 0.02734854943722097 |
| 0.0900000004095 |
| 0.027347182112297627 |
Scenario: Calculate regular inverted sqrt with specific numbers
Given the number n
| n |
| 1 |
| 1.1 |
| 100 |
| 1337 |
| 123.45678900 |
| 1337.1337 |
When we calculate the inverted square root of it normally
Then the result is m
| m |
| 1 |
| 0.9534625892455922 |
| 0.1 |
| 0.02734854943722097 |
| 0.0900000004095 |
| 0.027347182112297627 |
Scenario: Some numbers are about the same (0)
Given the number n
| n |
| 1 |
2024-01-15 16:38:23 +01:00
| 0.9 |
2024-01-15 16:29:55 +01:00
| 1.0001 |
2024-01-15 16:38:23 +01:00
| 1.1001 |
| 1.1050 |
2024-01-15 16:29:55 +01:00
| 0.999 |
| 0.9999999999 |
Then they are about the same
Scenario: Some numbers are about the same (1)
Given the number n
| n |
| 10 |
| 10.0001 |
| 9.997 |
| 10.025 |
Then they are about the same
Scenario: Some numbers are about the same (-3)
Given the number n
| n |
| -1000 |
| -1000.1 |
| -1001.1 |
Then they are about the same
Scenario: Some numbers are about the same (3)
Given the number n
| n |
| -1000 |
| -1000.1 |
| -1001.1 |
Then they are about the same
Scenario: Some numbers are about the same (7)
Given the number n
| n |
| 10000000 |
| 10000000 |
| 10000300 |
| 10000000.1 |
| 10000001.1 |
Then they are about the same
Scenario: Some numbers are not about the same (1)
Given the number n
| n |
| 2 |
| -2 |
| 0 |
| 20 |
| 20000 |
Then they are not about the same
Scenario: Some numbers are not about the same (7)
Given the number n
| n |
| 10000000 |
| 10001000 |
| 0 |
| 20000001.1 |
Then they are not about the same