@@ -11,9 +11,9 @@ public static class BranchAndBoundKnapsackSolverTests
11
11
public static void BranchAndBoundTest_Example1_Success ( )
12
12
{
13
13
// Arrange
14
- var items = new [ ] { 'A' , 'B' , 'C' , 'D' } ;
15
- var values = new [ ] { 18 , 20 , 14 , 18 } ;
16
- var weights = new [ ] { 2 , 4 , 6 , 9 } ;
14
+ var items = new [ ] { 'A' , 'B' , 'C' , 'D' } ;
15
+ var values = new [ ] { 18 , 20 , 14 , 18 } ;
16
+ var weights = new [ ] { 2 , 4 , 6 , 9 } ;
17
17
18
18
var capacity = 15 ;
19
19
@@ -25,16 +25,16 @@ public static void BranchAndBoundTest_Example1_Success()
25
25
var actualResult = solver . Solve ( items , capacity , weightSelector , valueSelector ) ;
26
26
27
27
// Assert
28
- actualResult . Should ( ) . BeEquivalentTo ( 'A' , 'B' , 'D' ) ;
28
+ actualResult . Should ( ) . BeEquivalentTo ( new [ ] { 'A' , 'B' , 'D' } ) ;
29
29
}
30
30
31
31
[ Test ]
32
32
public static void BranchAndBoundTest_Example2_Success ( )
33
33
{
34
34
// Arrange
35
- var items = new [ ] { 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'H' , 'I' , 'J' } ;
35
+ var items = new [ ] { 'A' , 'B' , 'C' , 'D' , 'E' , 'F' , 'G' , 'H' , 'I' , 'J' } ;
36
36
var values = new [ ] { 505 , 352 , 458 , 220 , 354 , 414 , 498 , 545 , 473 , 543 } ;
37
- var weights = new [ ] { 23 , 26 , 20 , 18 , 32 , 27 , 29 , 26 , 30 , 27 } ;
37
+ var weights = new [ ] { 23 , 26 , 20 , 18 , 32 , 27 , 29 , 26 , 30 , 27 } ;
38
38
39
39
var capacity = 67 ;
40
40
@@ -46,16 +46,16 @@ public static void BranchAndBoundTest_Example2_Success()
46
46
var actualResult = solver . Solve ( items , capacity , weightSelector , valueSelector ) ;
47
47
48
48
// Assert
49
- actualResult . Should ( ) . BeEquivalentTo ( 'H' , 'D' , 'A' ) ;
49
+ actualResult . Should ( ) . BeEquivalentTo ( new [ ] { 'H' , 'D' , 'A' } ) ;
50
50
}
51
51
52
52
[ Test ]
53
53
public static void BranchAndBoundTest_CapacityIsZero_NothingTaken ( )
54
54
{
55
55
// Arrange
56
- var items = new [ ] { 'A' , 'B' , 'C' , 'D' } ;
57
- var values = new [ ] { 18 , 20 , 14 , 18 } ;
58
- var weights = new [ ] { 2 , 4 , 6 , 9 } ;
56
+ var items = new [ ] { 'A' , 'B' , 'C' , 'D' } ;
57
+ var values = new [ ] { 18 , 20 , 14 , 18 } ;
58
+ var weights = new [ ] { 2 , 4 , 6 , 9 } ;
59
59
60
60
var capacity = 0 ;
61
61
@@ -74,9 +74,9 @@ public static void BranchAndBoundTest_CapacityIsZero_NothingTaken()
74
74
public static void BranchAndBoundTest_PlentyCapacity_EverythingIsTaken ( )
75
75
{
76
76
// Arrange
77
- var items = new [ ] { 'A' , 'B' , 'C' , 'D' } ;
78
- var values = new [ ] { 18 , 20 , 14 , 18 } ;
79
- var weights = new [ ] { 2 , 4 , 6 , 9 } ;
77
+ var items = new [ ] { 'A' , 'B' , 'C' , 'D' } ;
78
+ var values = new [ ] { 18 , 20 , 14 , 18 } ;
79
+ var weights = new [ ] { 2 , 4 , 6 , 9 } ;
80
80
81
81
var capacity = 1000 ;
82
82
0 commit comments