# Two Bucket exercise: very confused by 1 test

Hi, I’ve had a go at the Ruby track’s Two Bucket exercise, and have all bar 1 test now passing for me.

I’ve read the definition of the failing test several times, and have re-read the exercise description several times, but unfortunately I still can’t seem to understand this one test.

I’ve seen there have been lots of passing community solutions submitted since the test was last edited, so I’m hesitant to suggest that the test might be broken.

Please can someone double-check my logic below and confirm whether the test makes sense, and if so, where my misunderstanding is?

The test in question:

``````  def test_measure_using_bucket_one_of_size_2_and_bucket_two_of_size_3_start_with_bucket_one_and_end_with_bucket_two
skip
subject = TwoBucket.new(2, 3, 3, "one")
assert_equal 2, subject.moves
assert_equal "two", subject.goal_bucket
assert_equal 2, subject.other_bucket
end
``````

My understanding is that the 4 initialization inputs are:

• The size of the first bucket.
• The size of the second bucket.
• The desired volume to achieve in one of the two buckets.

To reach the desired volume, we have to:

• fill up the starting bucket.
• pour into the other bucket until either the starting bucket is empty or the other bucket is full.
• empty the other bucket if it is full.
• stop as soon as the desired volume has been reached exactly in either bucket.

My understanding of the 3 methods:

• `moves` = total number of moves to reach the result.
• `goal_bucket` = either “one” or “two”. Represents which bucket contains the desired volume at the end.
• `other_bucket` = the volume left in the non-goal bucket at the end.

In this example, my understanding is that we would do the following steps:

1. Fill the starting bucket (a = 2, b = 0)
2. Pour into the other bucket (a = 0, b = 2)
3. Refill the starting bucket (a = 2, b = 2)
4. Pour across as much as we can until the other bucket is full (a = 1, b = 3)

That results in:

• `moves == 4`
• `goal_bucket == "two"`
• `other_bucket == 1`

1b. If there is something special about the second bucket’s size…

No.

• Move 1 is always “fill the first bucket” (might not be bucket named “one”).
• Move 2 might be “fill the second bucket”.
1 Like

Perfect, thanks, I hadn’t realised we could do that.

Thank you both for your help!