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.119 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.118 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.117 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.116 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.115 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.114 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.113 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.111 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.110 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.109 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.108 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.107 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.106 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.105 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.104 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.103 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.102 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.101 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.100 tracks/cfml/exercises/grains/GrainsTest.cfc
trackler-2.2.1.99 tracks/cfml/exercises/grains/GrainsTest.cfc