@@ -74,32 +74,35 @@ describe('TwoBucket', () => {
7474 } ) ;
7575 } ) ;
7676
77- describe ( 'Reachability' , ( ) => {
78- const buckOne = 6 ;
79- const buckTwo = 15 ;
77+ xtest ( 'Measure using bucket one much bigger than bucket two' , ( ) => {
78+ const twoBucket = new TwoBucket ( 5 , 1 , 2 , 'one' ) ;
79+ const result = twoBucket . solve ( ) ;
80+ expect ( result . moves ) . toEqual ( 6 ) ;
81+ expect ( result . goalBucket ) . toEqual ( 'one' ) ;
82+ expect ( result . otherBucket ) . toEqual ( 1 ) ;
83+ } ) ;
8084
81- xtest ( 'Not possible to reach the goal, start with bucket one' , ( ) => {
82- expect ( ( ) => new TwoBucket ( buckOne , buckTwo , 5 , 'one' ) ) . toThrow ( ) ;
83- } ) ;
85+ xtest ( 'Measure using bucket one much smaller than bucket two' , ( ) => {
86+ const twoBucket = new TwoBucket ( 3 , 15 , 9 , 'one' ) ;
87+ const result = twoBucket . solve ( ) ;
88+ expect ( result . moves ) . toEqual ( 6 ) ;
89+ expect ( result . goalBucket ) . toEqual ( 'two' ) ;
90+ expect ( result . otherBucket ) . toEqual ( 0 ) ;
91+ } ) ;
8492
85- xtest ( 'Not possible to reach the goal, start with bucket two ' , ( ) => {
86- expect ( ( ) => new TwoBucket ( buckOne , buckTwo , 5 , 'two ' ) ) . toThrow ( ) ;
87- } ) ;
93+ xtest ( 'Not possible to reach the goal' , ( ) => {
94+ expect ( ( ) => new TwoBucket ( 6 , 15 , 5 , 'one ' ) ) . toThrow ( ) ;
95+ } ) ;
8896
89- xtest ( 'With the same buckets but a different goal, then it is possible' , ( ) => {
90- const starterBuck = 'one' ;
91- const goal = 9 ;
92- const twoBucket = new TwoBucket ( buckOne , buckTwo , goal , starterBuck ) ;
93- const result = twoBucket . solve ( ) ;
94- expect ( result . moves ) . toEqual ( 10 ) ;
95- expect ( result . goalBucket ) . toEqual ( 'two' ) ;
96- expect ( result . otherBucket ) . toEqual ( 0 ) ;
97- } ) ;
97+ xtest ( 'With the same buckets but a different goal, then it is possible' , ( ) => {
98+ const twoBucket = new TwoBucket ( 6 , 15 , 9 , 'one' ) ;
99+ const result = twoBucket . solve ( ) ;
100+ expect ( result . moves ) . toEqual ( 10 ) ;
101+ expect ( result . goalBucket ) . toEqual ( 'two' ) ;
102+ expect ( result . otherBucket ) . toEqual ( 0 ) ;
98103 } ) ;
99104
100- describe ( 'Goal larger than both buckets' , ( ) => {
101- xtest ( 'Is impossible' , ( ) => {
102- expect ( ( ) => new TwoBucket ( 5 , 7 , 8 , 'one' ) ) . toThrow ( ) ;
103- } ) ;
105+ xtest ( 'Goal larger than both buckets is impossible' , ( ) => {
106+ expect ( ( ) => new TwoBucket ( 5 , 7 , 8 , 'one' ) ) . toThrow ( ) ;
104107 } ) ;
105108} ) ;
0 commit comments