Refine the implementation of BooleanKnapsack with test cases