MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / getPartitionProblemTestCases

Function getPartitionProblemTestCases

dynamic/partitionproblem_test.go:16–27  ·  view source on GitHub ↗

getPartitionProblemTestCases returns a list of test cases for the Partition Problem

()

Source from the content-addressed store, hash-verified

14
15// getPartitionProblemTestCases returns a list of test cases for the Partition Problem
16func 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
30func TestPartitionProblem(t *testing.T) {

Callers 1

TestPartitionProblemFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected