Sha256: b2cf32f1150b45a32222479ba488aca294f8b712a2c2151e64a8c2270ad67d7e

Contents?: true

Size: 1.38 KB

Versions: 146

Compression:

Stored size: 1.38 KB

Contents

component extends="testbox.system.BaseSpec" {

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

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

			describe( 'returns the number of grains on the square', function(){

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

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

				it( '3', function(){
					expect( SUT.square( input='3' ) ).toBe( '4' );
				});

				it( '4', function(){
					expect( SUT.square( input='4' ) ).toBe( '8' );
				});

				it( '16', function(){
					expect( SUT.square( input='16' ) ).toBe( '32768' );
				});

				it( '32', function(){
					expect( SUT.square( input='32' ) ).toBe( '2147483648' );
				});

				it( '64', function(){
					expect( SUT.square( input='64' ) ).toBe( '9223372036854775808' );
				});

				it( 'square 0 raises an exception', function(){
					expect( SUT.square( input='0' ) ).toBe( '-1' );
				});

				it( 'negative square raises an exception', function(){
					expect( SUT.square( input='-1' ) ).toBe( '-1' );
				});

				it( 'square greater than 64 raises an exception', function(){
					expect( SUT.square( input='65' ) ).toBe( '-1' );
				});

			});

			it( 'returns the total number of grains on the board', function(){
				expect( SUT.total() ).toBe( 18446744073709551615 );
			});

		});
		
	}
 
}

Version data entries

146 entries across 145 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.179 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.178 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.177 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.176 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.175 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.174 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.173 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.172 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.171 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.170 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.169 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.167 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.166 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.165 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.164 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.163 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.162 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.161 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.160 tracks/cfml/exercises/grains/GrainsTest.cfc