diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e921fa3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,10 @@ +# c +*.o + +# Maven +target + +# Intellij IDEA +.idea +*.iml + diff --git a/source-code/StringCT-java/lib/bcprov-jdk15on-156.jar b/source-code/StringCT-java/lib/bcprov-jdk15on-156.jar deleted file mode 100644 index ffd08d6..0000000 Binary files a/source-code/StringCT-java/lib/bcprov-jdk15on-156.jar and /dev/null differ diff --git a/source-code/StringCT-java/lib/commons-codec-1.10.jar b/source-code/StringCT-java/lib/commons-codec-1.10.jar deleted file mode 100644 index 1d7417c..0000000 Binary files a/source-code/StringCT-java/lib/commons-codec-1.10.jar and /dev/null differ diff --git a/source-code/StringCT-java/lib/commons-pool2-2.4.2.jar b/source-code/StringCT-java/lib/commons-pool2-2.4.2.jar deleted file mode 100644 index fdf8b6f..0000000 Binary files a/source-code/StringCT-java/lib/commons-pool2-2.4.2.jar and /dev/null differ diff --git a/source-code/StringCT-java/pom.xml b/source-code/StringCT-java/pom.xml new file mode 100644 index 0000000..ca5391b --- /dev/null +++ b/source-code/StringCT-java/pom.xml @@ -0,0 +1,85 @@ + + + 4.0.0 + + research-lab + StringCT + 0-SNAPSHOT + + + 1.8 + 1.8 + UTF-8 + + + 4.12 + 1.59 + 2.4.2 + 1.10 + + + + + + org.bouncycastle + bcprov-debug-jdk15on + ${bcprov-jdk15on.version} + + + + org.apache.commons + commons-pool2 + ${commons-pool2.version} + + + + commons-codec + commons-codec + ${commons-codec.version} + + + + + junit + junit + ${junit.version} + test + + + + + + ${project.basedir}/src + ${project.basedir}/test + + + maven-surefire-plugin + 2.18.1 + + 1 + false + + + + 3.0.1 + org.apache.maven.plugins + maven-source-plugin + + + attach-sources + verify + + jar-no-fork + + + + + + + diff --git a/source-code/StringCT-java/test/org/nem/core/utils/ArrayUtilsTest.java b/source-code/StringCT-java/test/org/nem/core/utils/ArrayUtilsTest.java new file mode 100644 index 0000000..3f8ef12 --- /dev/null +++ b/source-code/StringCT-java/test/org/nem/core/utils/ArrayUtilsTest.java @@ -0,0 +1,29 @@ +package org.nem.core.utils; + + +import static org.junit.Assert.assertArrayEquals; +import static org.junit.Assert.assertEquals; + +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import org.junit.Test; + +public class ArrayUtilsTest { + + @Test + public void duplicate() { + + // Arrange + byte[] bytes = "test".getBytes(StandardCharsets.UTF_8); + int bytesHash = Arrays.hashCode(bytes); + + // Act + byte[] duplicate = ArrayUtils.duplicate(bytes); + + // Assert: original array is unchanged + assertEquals(bytesHash, Arrays.hashCode(bytes)); + + // Assert: check duplicate + assertArrayEquals(bytes, duplicate); + } +}