mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-04 07:29:47 +08:00

* Add an algorithm to find length and area of an arc of a circle * Updated to follow Javascript Standard Style * Update CircularArc.js * Update CircularArc.js * Add tests * Followed Javascript standard style
20 lines
685 B
JavaScript
20 lines
685 B
JavaScript
import { circularArcLength, circularArcArea } from '../CircularArc'
|
|
|
|
describe('circularArcLength', () => {
|
|
it('with natural number', () => {
|
|
const arcLengthOfOneThirty = circularArcLength(1, 30)
|
|
const arcLengthOfThreeSixty = circularArcLength(3, 60)
|
|
expect(arcLengthOfOneThirty).toBe(0.5235987755982988)
|
|
expect(arcLengthOfThreeSixty).toBe(3.141592653589793)
|
|
})
|
|
})
|
|
|
|
describe('circularArcArea', () => {
|
|
it('with natural number', () => {
|
|
const arcAreaOfOneThirty = circularArcArea(1, 30)
|
|
const arcAreaOfThreeSixty = circularArcArea(3, 60)
|
|
expect(arcAreaOfOneThirty).toBe(0.2617993877991494)
|
|
expect(arcAreaOfThreeSixty).toBe(4.71238898038469)
|
|
})
|
|
})
|