forked from TheAlgorithms/JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMandelbrot.test.js
More file actions
21 lines (17 loc) · 811 Bytes
/
Mandelbrot.test.js
File metadata and controls
21 lines (17 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import { getRGBData } from '../Mandelbrot'
describe('Mandelbrot', () => {
it('should produce black pixels inside the set', () => {
const blackAndWhite = getRGBData(800, 600, -0.6, 0, 3.2, 50, false)
expect(blackAndWhite[400][300]).toEqual([0, 0, 0]) // black
const colorCoded = getRGBData(800, 600, -0.6, 0, 3.2, 50, true)
expect(colorCoded[400][300]).toEqual([0, 0, 0]) // black
})
it('should produce white pixels outside of the set', () => {
const blackAndWhite = getRGBData(800, 600, -0.6, 0, 3.2, 50, false)
expect(blackAndWhite[0][0]).toEqual([255, 255, 255]) // black
})
it('should produce colored pixels distant to the set', () => {
const colorCoded = getRGBData(800, 600, -0.6, 0, 3.2, 50, true)
expect(colorCoded[0][0]).toEqual([255, 0, 0]) // red
})
})