FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaScript/Maths/test/ModularArithmetic.test.js at master · TheAlgorithms/JavaScript · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
TheAlgorithms
/
JavaScript
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
5.8k
Star
34.2k
Code
Issues
21
Pull requests
192
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaScript
/
Maths
/
test
/
ModularArithmetic.test.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
45 lines (40 loc) · 1.24 KB
Breadcrumbs
JavaScript
/
Maths
/
test
/
ModularArithmetic.test.js
Copy path
File metadata and controls
45 lines (40 loc) · 1.24 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import
{
ModRing
}
from
'../ModularArithmetic'
describe
(
'Modular Arithmetic'
,
(
)
=>
{
const
MOD
=
10000007
let
ring
beforeEach
(
(
)
=>
{
ring
=
new
ModRing
(
MOD
)
}
)
describe
(
'add'
,
(
)
=>
{
it
(
'Should return 9999993 for 10000000 and 10000000'
,
(
)
=>
{
expect
(
ring
.
add
(
10000000
,
10000000
)
)
.
toBe
(
9999993
)
}
)
it
(
'Should return 9999986 for 10000000 and 20000000'
,
(
)
=>
{
expect
(
ring
.
add
(
10000000
,
20000000
)
)
.
toBe
(
9999986
)
}
)
}
)
describe
(
'subtract'
,
(
)
=>
{
it
(
'Should return 1000000 for 10000000 and 9000000'
,
(
)
=>
{
expect
(
ring
.
subtract
(
10000000
,
9000000
)
)
.
toBe
(
1000000
)
}
)
it
(
'Should return 7 for 10000000 and 20000000'
,
(
)
=>
{
expect
(
ring
.
subtract
(
10000000
,
20000000
)
)
.
toBe
(
7
)
}
)
}
)
describe
(
'multiply'
,
(
)
=>
{
it
(
'Should return 1000000 for 100000 and 10000'
,
(
)
=>
{
expect
(
ring
.
multiply
(
100000
,
10000
)
)
.
toBe
(
9999307
)
}
)
it
(
'Should return 7 for 100000 and 10000100'
,
(
)
=>
{
expect
(
ring
.
multiply
(
10000000
,
20000000
)
)
.
toBe
(
98
)
}
)
}
)
describe
(
'divide'
,
(
)
=>
{
it
(
'Should return 4 for 3 and 11'
,
(
)
=>
{
expect
(
ring
.
divide
(
3
,
11
)
)
.
toBe
(
4
)
}
)
it
(
'Should return 2 for 18 and 7'
,
(
)
=>
{
expect
(
ring
.
divide
(
18
,
7
)
)
.
toBe
(
2
)
}
)
}
)
}
)
Back
|
FazBrowse Home
|
New Git URL