-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jimeng
committed
Oct 7, 2024
1 parent
ebe3d00
commit 6153921
Showing
3 changed files
with
60 additions
and
33 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
package org.simdjson; | ||
|
||
import java.util.Arrays; | ||
|
||
public class BitIndexes { | ||
|
||
private final int[] indexes; | ||
|
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.simdjson; | ||
|
||
import static org.simdjson.testutils.SimdJsonAssertions.assertThat; | ||
import static org.simdjson.testutils.TestUtils.toUtf8; | ||
|
||
import org.junit.jupiter.api.Test; | ||
|
||
public class JsonMultiValueParsingTest { | ||
@Test | ||
public void test() { | ||
byte[] json = toUtf8("{\"field1\":{\"field2\":\"value2\",\"field3\":3},\"field4\":[\"value4\",\"value5\"],\"field5\":null}"); | ||
SimdJsonParser2 parser = new SimdJsonParser2("field1.field2", "field1.field3", "field4", "field4.0", "field5"); | ||
String[] result = parser.parse(json, json.length); | ||
assertThat(result[0]).isEqualTo("value2"); | ||
assertThat(result[1]).isEqualTo("3"); | ||
assertThat(result[2]).isEqualTo("[\"value4\",\"value5\"]"); | ||
assertThat(result[3]).isEqualTo("value4"); | ||
assertThat(result[4]).isEqualTo(null); | ||
} | ||
|
||
@Test | ||
public void testNonAsciiCharacters() { | ||
byte[] json = toUtf8("{\"ąćśńźż\": 1, \"\\u20A9\\u0E3F\": 2, \"αβγ\": 3, \"😀abc😀\": 4}"); | ||
SimdJsonParser2 parser = new SimdJsonParser2("ąćśńźż", "\\u20A9\\u0E3F", "αβγ", "😀abc😀"); | ||
// when | ||
String[] result = parser.parse(json, json.length); | ||
// then | ||
assertThat(result[0]).isEqualTo("1"); | ||
assertThat(result[1]).isEqualTo("2"); | ||
assertThat(result[2]).isEqualTo("3"); | ||
assertThat(result[3]).isEqualTo("4"); | ||
} | ||
} |