Hi,
I recently solved the two bucket problem. Doing so I felt two tests were missing to cover common pitfalls.
The tests :
#[test]
fn test_several_pour_in_smaller() {
let output = solve(5, 1, 2, &Bucket::One);
let expected = Some(BucketStats {
moves: 6,
goal_bucket: Bucket::One,
other_bucket: 1,
});
assert_eq!(output, expected);
}
#[test]
fn test_several_pour_in_bigger() {
let output = solve(3, 15, 9, &Bucket::One);
let expected = Some(BucketStats {
moves: 6,
goal_bucket: Bucket::Two,
other_bucket: 0,
});
assert_eq!(output, expected);
}
Those tests are usfull when we try to solve the exercise using diophantine equations (ax-by=c) with (a,b) capacities, c goal and (x,y) number of filling/emptying
using the euler extended algorythm doesnāt guarantee to give positive solutions for x and y. We must adapt it a bit for the exercise. Those tests covers this and one will catch x<0, the other y<0.
In the c++ community solution I saw several solutions that would break at least one of those tests. I donāt know if itās possible to run those on all exercise to verify itās useful.
Also Iād really like to contribute to exercism and it could be a nice first contribution for me.
I understood that we should first modify problem-specifications/exercises/two-bucket/canonical-data.json at main Ā· exercism/problem-specifications Ā· GitHub before adapting the different languages.
I read a lot of docs on how to contribute but there is so much stuff Iām a bit lost, I understood it should be discussed here but Iām not sure how to continue.
I solved the exercise and wrote those tests in C++ and Rust. I could contribute also on other languages.
Any feedback/advice/guidance would be appreciated.