Skip to content
Snippets Groups Projects
Commit d3cfbd10 authored by Rob Adams's avatar Rob Adams
Browse files

Update tests

parent 5a8ee386
No related branches found
No related tags found
No related merge requests found
......@@ -66,7 +66,7 @@ public class TUtils {
* @param nodes The sequence of nodes
* @return A VectorClock initialized with the given sequence of events
*/
public static VectorClock getClock(long timestamp, int... nodes) {
public static VectorClock getClockT(long timestamp, int... nodes) {
VectorClock clock = new VectorClock(timestamp);
return increment(clock, nodes);
}
......
......@@ -17,7 +17,7 @@ import org.sdnplatform.sync.internal.util.ByteArray;
import org.sdnplatform.sync.internal.version.VectorClock;
import static org.junit.Assert.*;
import static org.sdnplatform.sync.internal.TUtils.getClock;
import static org.sdnplatform.sync.internal.TUtils.*;
public class JavaDBStorageEngineTest extends AbstractStorageEngineT {
......
......@@ -17,11 +17,12 @@
package org.sdnplatform.sync.internal.version;
import static org.junit.Assert.*;
import static org.sdnplatform.sync.internal.TUtils.getClock;
import static org.sdnplatform.sync.internal.TUtils.getClockT;
import org.junit.Test;
import org.sdnplatform.sync.IVersion.Occurred;
import org.sdnplatform.sync.internal.TUtils;
import static org.sdnplatform.sync.internal.TUtils.*;
import org.sdnplatform.sync.internal.version.ClockEntry;
import org.sdnplatform.sync.internal.version.VectorClock;
......@@ -37,8 +38,8 @@ public class VectorClockTest {
@Test
public void testEqualsAndHashcode() {
long now = 5555555555L;
VectorClock one = getClock(now, 1, 2);
VectorClock other = getClock(now, 1, 2);
VectorClock one = getClockT(now, 1, 2);
VectorClock other = getClockT(now, 1, 2);
assertEquals(one, other);
assertEquals(one.hashCode(), other.hashCode());
}
......@@ -103,9 +104,9 @@ public class VectorClockTest {
int numValues = 100;
VectorClock[] clocks = new VectorClock[numNodes];
for(int t = 0; t < numTests; t++) {
int[] test = TUtils.randomInts(numNodes, numValues);
int[] test = randomInts(numNodes, numValues);
for(int n = 0; n < numNodes; n++)
clocks[n] = getClock(TUtils.shuffle(test));
clocks[n] = getClock(shuffle(test));
// test all are equal
for(int n = 0; n < numNodes - 1; n++)
assertEquals("Clock " + n + " and " + (n + 1) + " are not equal.",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment