|
| 1 | +import { |
| 2 | + isTriangular, |
| 3 | + isTetrahedral, |
| 4 | + isPentatope, |
| 5 | + checkAll |
| 6 | +} from '../FigurateNumber' |
| 7 | + |
| 8 | +describe('FigurateNumber', () => { |
| 9 | + it('Triangular : should return true', () => { |
| 10 | + expect(isTriangular(1)).toEqual(true) |
| 11 | + }) |
| 12 | + it('Triangular : should return true', () => { |
| 13 | + expect(isTriangular(3)).toEqual(true) |
| 14 | + }) |
| 15 | + |
| 16 | + it('Triangular : should return false', () => { |
| 17 | + expect(isTriangular(5)).toEqual(false) |
| 18 | + }) |
| 19 | + |
| 20 | + it('Triangular : should return true', () => { |
| 21 | + expect(isTriangular(171)).toEqual(true) |
| 22 | + }) |
| 23 | + /** End */ |
| 24 | + |
| 25 | + it('Tetrahedral : should return true', () => { |
| 26 | + expect(isTetrahedral(1)).toEqual(true) |
| 27 | + }) |
| 28 | + it('Tetrahedral : should return true', () => { |
| 29 | + expect(isTetrahedral(4)).toEqual(true) |
| 30 | + }) |
| 31 | + |
| 32 | + it('Tetrahedral : should return false', () => { |
| 33 | + expect(isTetrahedral(3)).toEqual(false) |
| 34 | + }) |
| 35 | + |
| 36 | + it('Tetrahedral : should return true', () => { |
| 37 | + expect(isTetrahedral(165)).toEqual(true) |
| 38 | + }) |
| 39 | + |
| 40 | + /** End */ |
| 41 | + it('Pentatope : should return true', () => { |
| 42 | + expect(isPentatope(1)).toEqual(true) |
| 43 | + }) |
| 44 | + it('Pentatope : should return true', () => { |
| 45 | + expect(isPentatope(5)).toEqual(true) |
| 46 | + }) |
| 47 | + |
| 48 | + it('Pentatope : should return false', () => { |
| 49 | + expect(isPentatope(3)).toEqual(false) |
| 50 | + }) |
| 51 | + |
| 52 | + it('Pentatope : should return true', () => { |
| 53 | + expect(isPentatope(1001)).toEqual(true) |
| 54 | + }) |
| 55 | + /** End */ |
| 56 | + |
| 57 | + it('Check All : should return all true',() => { |
| 58 | + expect(checkAll(1)).toEqual({ |
| 59 | + isTriangular: true, |
| 60 | + isTetrahedral: true, |
| 61 | + isPentatope: true |
| 62 | + }) |
| 63 | + }) |
| 64 | + |
| 65 | + it('Check All : should return all true,true,false',() => { |
| 66 | + expect(checkAll(15)).toEqual({ |
| 67 | + isTriangular: true, |
| 68 | + isTetrahedral: false, |
| 69 | + isPentatope: true |
| 70 | + }) |
| 71 | + }) |
| 72 | +}) |
0 commit comments