1
exercism fetch cfml nth-prime

NthPrimeTest.cfc

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
component extends="testbox.system.BaseSpec" {

	function beforeAll(){
	  SUT = createObject( 'NthPrime' );
	}

	function run(){
	
		describe( "My NthPrime class", function(){			

			it( 'first prime', function(){
				expect( SUT.prime( input='1' ) ).toBe( '2' );
			});

			it( 'second prime', function(){
				expect( SUT.prime( input='2' ) ).toBe( '3' );
			});

			it( 'sixth prime', function(){
				expect( SUT.prime( input='6' ) ).toBe( '13' );
			});

			it( 'big prime', function(){
				expect( SUT.prime( input='10001' ) ).toBe( '104743' );
			});

			it( 'there is no zeroth prime', function(){
				expect( SUT.prime( input='0' ) ).toBeFalse();
			});

		});
		
	}
 
}