Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SAT4J
sat4j
Commits
6c8c8c13
Commit
6c8c8c13
authored
Nov 09, 2018
by
Daniel Le Berre
Browse files
New test case to make sure that the order is properly maintained. Thanks
STAMP.
parent
309b935d
Pipeline
#3333
passed with stages
in 47 minutes and 17 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
org.sat4j.core/src/test/java/org/sat4j/minisat/core/HeapTest.java
View file @
6c8c8c13
...
...
@@ -29,10 +29,10 @@
*******************************************************************************/
package
org.sat4j.minisat.core
;
import
junit.framework.TestCase
;
import
org.sat4j.minisat.orders.ActivityBasedVariableComparator
;
import
junit.framework.TestCase
;
public
class
HeapTest
extends
TestCase
{
/*
...
...
@@ -46,8 +46,8 @@ public class HeapTest extends TestCase {
* Test method for 'org.sat4j.minisat.core.Heap.inHeap(int)'
*/
public
void
testInHeap
()
{
Heap
heap
=
new
Heap
(
new
ActivityBasedVariableComparator
(
new
double
[]
{
0.0
,
3.0
,
9.0
,
2.0
}));
Heap
heap
=
new
Heap
(
new
ActivityBasedVariableComparator
(
new
double
[]
{
0.0
,
3.0
,
9.0
,
2.0
}));
heap
.
setBounds
(
5
);
assertFalse
(
heap
.
inHeap
(
1
));
assertFalse
(
heap
.
inHeap
(
2
));
...
...
@@ -83,15 +83,26 @@ public class HeapTest extends TestCase {
* Test method for 'org.sat4j.minisat.core.Heap.increase(int)'
*/
public
void
testIncrease
()
{
double
[]
activity
=
new
double
[]
{
0.0
,
3.0
,
6.0
,
9.0
};
Heap
heap
=
new
Heap
(
new
ActivityBasedVariableComparator
(
activity
));
heap
.
setBounds
(
5
);
heap
.
insert
(
1
);
heap
.
insert
(
2
);
heap
.
insert
(
3
);
assertEquals
(
3
,
heap
.
getmin
());
assertFalse
(
heap
.
inHeap
(
3
));
heap
.
insert
(
3
);
activity
[
2
]
=
12.0
;
heap
.
increase
(
2
);
assertEquals
(
2
,
heap
.
getmin
());
}
/*
* Test method for 'org.sat4j.minisat.core.Heap.empty()'
*/
public
void
testEmpty
()
{
Heap
heap
=
new
Heap
(
new
ActivityBasedVariableComparator
(
new
double
[]
{}));
Heap
heap
=
new
Heap
(
new
ActivityBasedVariableComparator
(
new
double
[]
{}));
assertTrue
(
heap
.
empty
());
}
...
...
@@ -99,8 +110,8 @@ public class HeapTest extends TestCase {
* Test method for 'org.sat4j.minisat.core.Heap.insert(int)'
*/
public
void
testInsert
()
{
Heap
heap
=
new
Heap
(
new
ActivityBasedVariableComparator
(
new
double
[]
{
0.0
,
1.0
,
1.0
,
2.0
}));
Heap
heap
=
new
Heap
(
new
ActivityBasedVariableComparator
(
new
double
[]
{
0.0
,
1.0
,
1.0
,
2.0
}));
heap
.
setBounds
(
5
);
heap
.
insert
(
1
);
heap
.
insert
(
2
);
...
...
@@ -114,8 +125,8 @@ public class HeapTest extends TestCase {
* Test method for 'org.sat4j.minisat.core.Heap.getmin()'
*/
public
void
testGetmin
()
{
Heap
heap
=
new
Heap
(
new
ActivityBasedVariableComparator
(
new
double
[]
{
0.0
,
3.0
,
9.0
,
2.0
}));
Heap
heap
=
new
Heap
(
new
ActivityBasedVariableComparator
(
new
double
[]
{
0.0
,
3.0
,
9.0
,
2.0
}));
heap
.
setBounds
(
5
);
heap
.
insert
(
1
);
heap
.
insert
(
2
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment