getPartitionProblemTestCases returns a list of test cases for the Partition Problem
()
| 14 | |
| 15 | // getPartitionProblemTestCases returns a list of test cases for the Partition Problem |
| 16 | func getPartitionProblemTestCases() []testCasePartitionProblem { |
| 17 | return []testCasePartitionProblem{ |
| 18 | {[]int{1, 5, 11, 5}, true}, // Example with a partitionable set |
| 19 | {[]int{1, 2, 3, 5}, false}, // Example where partition is not possible |
| 20 | {[]int{1, 2, 5}, false}, // Set cannot be partitioned into two subsets |
| 21 | {[]int{2, 2, 2, 2}, true}, // Even split possible with equal elements |
| 22 | {[]int{7, 3, 2, 1}, false}, // Set cannot be partitioned |
| 23 | {[]int{}, true}, // Empty set, can be partitioned trivially |
| 24 | {[]int{1}, false}, // Single element, cannot be partitioned |
| 25 | {[]int{10, 10, 10, 10}, true}, // Equal elements, partitionable |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | // TestPartitionProblem tests the PartitionProblem function with different test cases |
| 30 | func TestPartitionProblem(t *testing.T) { |
no outgoing calls
no test coverage detected