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.139 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.138 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.137 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.136 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.135 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.134 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.133 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.132 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.131 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.130 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.129 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.128 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.127 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.126 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.125 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.124 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.123 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.122 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.121 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.120 tracks/cfml/exercises/grains/GrainsTest.cfc