We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e26edda commit b3c1ad1Copy full SHA for b3c1ad1
examples/test/__main__.py
@@ -2,8 +2,23 @@
2
3
from __future__ import annotations
4
5
+from pathlib import Path
6
+from subprocess import run, PIPE
7
+
8
from ..factoradic import test
9
from ..print_primes import test_prime_stream
10
11
+EXAMPLES_DIR = Path(__file__).parent.parent
12
13
test_prime_stream()
14
test()
15
16
17
+def _get_nth_prime(num: int) -> int:
18
+ """Run nth_prime.sh."""
19
+ command = [(EXAMPLES_DIR / "nth_prime.sh").as_posix(), str(num)]
20
+ return int(run(command, check=True, stdout=PIPE).stdout)
21
22
23
+assert _get_nth_prime(100_000) == 1299709
24
+assert _get_nth_prime(200_000) == 2750159
0 commit comments