File tree 2 files changed +25
-25
lines changed
src/algorithms/math/primality-tests/__test__
2 files changed +25
-25
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
import trialDivision from '../trialDivision' ;
2
- import primalityTest from './primalityTest' ;
2
+
3
+ /**
4
+ * @param {function(n: number) } testFunction
5
+ */
6
+ function primalityTest ( testFunction ) {
7
+ expect ( testFunction ( 1 ) ) . toBeTruthy ( ) ;
8
+ expect ( testFunction ( 2 ) ) . toBeTruthy ( ) ;
9
+ expect ( testFunction ( 3 ) ) . toBeTruthy ( ) ;
10
+ expect ( testFunction ( 5 ) ) . toBeTruthy ( ) ;
11
+ expect ( testFunction ( 11 ) ) . toBeTruthy ( ) ;
12
+ expect ( testFunction ( 191 ) ) . toBeTruthy ( ) ;
13
+ expect ( testFunction ( 191 ) ) . toBeTruthy ( ) ;
14
+ expect ( testFunction ( 199 ) ) . toBeTruthy ( ) ;
15
+
16
+ expect ( testFunction ( - 1 ) ) . toBeFalsy ( ) ;
17
+ expect ( testFunction ( 0 ) ) . toBeFalsy ( ) ;
18
+ expect ( testFunction ( 4 ) ) . toBeFalsy ( ) ;
19
+ expect ( testFunction ( 6 ) ) . toBeFalsy ( ) ;
20
+ expect ( testFunction ( 12 ) ) . toBeFalsy ( ) ;
21
+ expect ( testFunction ( 14 ) ) . toBeFalsy ( ) ;
22
+ expect ( testFunction ( 25 ) ) . toBeFalsy ( ) ;
23
+ expect ( testFunction ( 192 ) ) . toBeFalsy ( ) ;
24
+ expect ( testFunction ( 200 ) ) . toBeFalsy ( ) ;
25
+ expect ( testFunction ( 400 ) ) . toBeFalsy ( ) ;
26
+ }
3
27
4
28
describe ( 'trialDivision' , ( ) => {
5
29
it ( 'should detect prime numbers' , ( ) => {
You can’t perform that action at this time.
0 commit comments