-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #145 from spryslmatej/chore/sm/junit5
chore: Upgrade test framework to JUnit5
- Loading branch information
Showing
12 changed files
with
723 additions
and
686 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
774 changes: 391 additions & 383 deletions
774
compiler/src/test/java/org/capnproto/test/EncodingTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
376 changes: 191 additions & 185 deletions
376
compiler/src/test/java/org/capnproto/test/TestUtil.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 8 additions & 7 deletions
15
runtime/src/test/java/org/capnproto/DefaultAllocatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,27 @@ | ||
package org.capnproto; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
public class DefaultAllocatorTest { | ||
@Test | ||
public void maxSegmentBytes() { | ||
DefaultAllocator allocator = new DefaultAllocator(); | ||
Assert.assertEquals(allocator.allocationStrategy, | ||
BuilderArena.AllocationStrategy.GROW_HEURISTICALLY); | ||
assertEquals(BuilderArena.AllocationStrategy.GROW_HEURISTICALLY, allocator.allocationStrategy); | ||
allocator.maxSegmentBytes = (1 << 25) - 1; | ||
|
||
int allocationSize = 1 << 24; | ||
allocator.setNextAllocationSizeBytes(allocationSize); | ||
|
||
Assert.assertEquals(allocationSize, | ||
assertEquals(allocationSize, | ||
allocator.allocateSegment(allocationSize).capacity()); | ||
|
||
Assert.assertEquals(allocator.maxSegmentBytes, | ||
assertEquals(allocator.maxSegmentBytes, | ||
allocator.allocateSegment(allocationSize).capacity()); | ||
|
||
Assert.assertEquals(allocator.maxSegmentBytes, | ||
assertEquals(allocator.maxSegmentBytes, | ||
allocator.allocateSegment(allocationSize).capacity()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,21 @@ | ||
package org.capnproto; | ||
|
||
import org.junit.Test; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.nio.ByteBuffer; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertThrows; | ||
|
||
public class ListBuilderTest { | ||
|
||
@Test(expected = IndexOutOfBoundsException.class) | ||
@Test | ||
public void _setBooleanElementShouldNotOverflowDuringPositionOffsetCalculation() { | ||
ByteBuffer buffer = ByteBuffer.allocate(10); | ||
BuilderArena builderArena = new BuilderArena(new DefaultAllocator()); | ||
SegmentBuilder segmentBuilder = new SegmentBuilder(buffer, builderArena); | ||
ListBuilder listBuilder = new ListBuilder(segmentBuilder, 0, 0, 2, 0, (short) 0); | ||
|
||
listBuilder._setBooleanElement(Integer.MAX_VALUE, true); | ||
assertThrows(IndexOutOfBoundsException.class, () -> listBuilder._setBooleanElement(Integer.MAX_VALUE, true)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.