-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed maths is_probably_prime power int
- Loading branch information
Showing
5 changed files
with
47 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Charts | ||
# hal.charts.plotter | ||
|
||
## Plot3d.param() | ||
```python | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# hal.tests | ||
|
||
## battery_test() | ||
```python | ||
from unittest import TestCase | ||
|
||
from hal.maths.maths import Integer | ||
from hal.tests.utils import battery_test, random_name | ||
|
||
|
||
def is_prime(string): | ||
return Integer(string).is_probably_prime() | ||
|
||
class EasyTest(TestCase): | ||
def test_primality(self): | ||
tests = { | ||
"2": True, # 2 is prime | ||
"3": True, # 3 is also prime | ||
"4": False, # 4 is NOT a prime (2 * 2) | ||
"997": True, # should be prime | ||
"4366114": False, # not a prime (divisible by 2) | ||
"14553714337": True, # this should be prime | ||
"58853781722270786163": False # not a prime (divisible by 3) | ||
} | ||
|
||
battery_test( | ||
self.assertEquals, tests, is_prime | ||
) | ||
``` | ||
|
||
```bash | ||
Ran 1 test in 0.000s | ||
|
||
OK | ||
``` | ||
|
||
|
||
## Questions and issues | ||
The [github issue tracker](https://github.com/sirfoga/pyhal/issues) is **only** for bug reports and feature requests. Anything else, such as questions for help in using the library, should be mailed [here](mailto:sirfoga@protonmail.com). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters