MCPcopy Create free account
hub / github.com/TheAlgorithms/Python / test_knapsack

Method test_knapsack

knapsack/tests/test_knapsack.py:41–49  ·  view source on GitHub ↗

test for the knapsack

(self)

Source from the content-addressed store, hash-verified

39 assert k.knapsack(cap, w, val, c) == 5
40
41 def test_knapsack(self):
42 """
43 test for the knapsack
44 """
45 cap = 50
46 val = [60, 100, 120]
47 w = [10, 20, 30]
48 c = len(val)
49 assert k.knapsack(cap, w, val, c) == 220
50
51 def test_knapsack_repetition(self):
52 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected