Skip to content

Commit 554e062

Browse files
committed
0.13.4 - Improve unit test coverage.
1 parent ad33795 commit 554e062

16 files changed

+51
-59
lines changed

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,14 @@ This project does its best to adhere to [Semantic Versioning](http://semver.org/
44

55

66
--------
7-
### [0.13.3](N/A) - 2019-10-03
7+
### [0.13.4](N/A) - 2020-04-25
8+
#### Changed
9+
* Improve unit tests
10+
* Remove `DataUnescapePartialQuoted.inputsNoClosingQuote` and `expectedNoClosingQuote` test data in favor of embedding it directly in test methods for readability.
11+
12+
13+
--------
14+
### [0.13.3](https://github.com/TeamworkGuy2/JTextUtil/commit/ad33795962590e43f7e8ce0fc52dbf459abf95f8) - 2019-10-03
815
#### Changed
916
* Fix accidental test class property name change in previous commit
1017
* First `twg2.text.benchmark` tests added

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ JTextUtil
44
Dependencies: none
55

66
### twg2.text.stringEscape
7-
Escape and unescape methods for JSON (`StringEscapeJson`), XML (`StringEscapeXml`), and strings with non-ASCII characters, quotes, or `\t \b \f \r` characters (`StringEscape` and `StringEscapePartial`).
7+
Escape and unescape methods for JSON (`StringEscapeJson`), XML (`StringEscapeXml`), and strings with non-ASCII characters, quotes, or escape `\t \b \f \r` characters (`StringEscape` and `StringEscapePartial`).
88

99
### twg2.text.stringSearch
10-
String search methods for indexOf/lastIndexOf (`StringIndex`), endsWith, startsWith, compare, contains (`StringCompare`), and common prefix/suffix (`StringCommonality`).
10+
String search methods for indexOf()/lastIndexOf() (`StringIndex`), endsWith(), startsWith(), compare(), contains() (`StringCompare`), and common prefix/suffix (`StringCommonality`).
1111

1212
### twg2.text.stringUtils
1313
String utility methods for join and repeat (`StringJoin`), pad (`StringPad`), split, substring, and Nth match (`StringSplit`), trim (`StringTrim`), replace (`StringReplace`), hex conversion (`StringHex`), empty/whitespace checking (`StringCheck`), code identifier case checking for camelCase, TitleCase, snake_case, etc (`StringCase`), and conversion to and from java.util.Properties format (`StringToProperties`).

bin/jtext_util-with-tests.jar

1.03 KB
Binary file not shown.

bin/jtext_util.jar

201 Bytes
Binary file not shown.

package-lib.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version" : "0.13.3",
2+
"version" : "0.13.4",
33
"name" : "jtext-util",
44
"description" : "String search, replace, and transform functions that provide more control, at the trade-off of verbosity, than those already in the Java API",
55
"homepage" : "https://github.com/TeamworkGuy2/JTextUtil",

src/twg2/text/stringUtils/ArrayUtilCopy.java

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package twg2.text.stringUtils;
22

3-
/** Copy of methods from JCollectionUtility arrayUtils.ArrayUtil
3+
/** Copy of methods from JArrays twg2.arrays.ArrayUtil
44
* @author TeamworkGuy2
55
* @since 2015-1-24
66
*/
@@ -13,19 +13,7 @@ class ArrayUtilCopy {
1313
* @return the index of the matching value, or -1 if the {@code value} could not be found
1414
*/
1515
public static final int indexOf(char[] ary, char value) {
16-
return indexOf(ary, 0, ary.length, value);
17-
}
18-
19-
20-
/** Search for a matching char in an array of chars
21-
* @param ary the array of values to search
22-
* @param off the offset into {@code ary} at which to start searching for values
23-
* @param len the number of values to search for starting at {@code off} in {@code ary}
24-
* @param value the value to search for
25-
* @return the index of the matching value, or -1 if the {@code value} could not be found
26-
*/
27-
public static final int indexOf(char[] ary, int off, int len, char value) {
28-
for(int i = off, size = off + len; i < size; i++) {
16+
for(int i = 0, size = ary.length; i < size; i++) {
2917
if(ary[i] == (value)) { return i; }
3018
}
3119
return -1;

test/twg2/text/benchmark/StringIndexPerf.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void indexOfTwg2() {
3333
}
3434
}
3535

36-
System.out.println(res);
36+
System.out.println(this.getClass().getSimpleName() + "-" + res);
3737
}
3838

3939

@@ -51,7 +51,7 @@ public void indexOfJava() {
5151
}
5252
}
5353

54-
System.out.println(res);
54+
System.out.println(this.getClass().getSimpleName() + "-" + res);
5555
}
5656

5757
}

test/twg2/text/benchmark/StringReplacePerf.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ public void replaceTwg2() {
2626
for(int i = 0; i < loops; i++) {
2727
int sub = 0;
2828
for(int j = 0, size = strs.size(); j < size; j++) {
29-
sub += StringReplace.replace(StringReplace.replace(strs.get(j), "-a", "-A"), "A", "B").hashCode() - (j < size - 1 ? StringReplace.replace(strs.get(j + 1), "A", "B").hashCode() : 0);
29+
sub += StringReplace.replace(StringReplace.replace(strs.get(j), "-a", "-A"), "A", "B").length() - (j < size - 1 ? StringReplace.replace(strs.get(j + 1), "A", "B").length() : 0);
3030
}
3131
if(i % 3 == 0 || i % 5 == 0) {
3232
res += sub;
3333
}
3434
}
3535

36-
System.out.println(res);
36+
System.out.println(this.getClass().getSimpleName() + "-" + res);
3737
}
3838

3939

@@ -44,14 +44,14 @@ public void replaceJava() {
4444
for(int i = 0; i < loops; i++) {
4545
int sub = 0;
4646
for(int j = 0, size = strs.size(); j < size; j++) {
47-
sub += strs.get(j).replace("-a", "-A").replace("A", "B").hashCode() - (j < size - 1 ? strs.get(j + 1).replace("A", "B").hashCode() : 0);
47+
sub += strs.get(j).replace("-a", "-A").replace("A", "B").length() - (j < size - 1 ? strs.get(j + 1).replace("A", "B").length() : 0);
4848
}
4949
if(i % 3 == 0 || i % 5 == 0) {
5050
res += sub;
5151
}
5252
}
5353

54-
System.out.println(res);
54+
System.out.println(this.getClass().getSimpleName() + "-" + res);
5555
}
5656

5757
}

test/twg2/text/benchmark/StringSplitPerf.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void splitTwg2() {
3333
}
3434
}
3535

36-
System.out.println(res);
36+
System.out.println(this.getClass().getSimpleName() + "-" + res);
3737
}
3838

3939

@@ -51,7 +51,7 @@ public void splitJava() {
5151
}
5252
}
5353

54-
System.out.println(res);
54+
System.out.println(this.getClass().getSimpleName() + "-" + res);
5555
}
5656

5757
}

test/twg2/text/test/DataUnescapePartialQuoted.java

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* @author TeamworkGuy2
88
*/
99
public class DataUnescapePartialQuoted {
10-
1110
public static int inputsOffset = 3;
1211

1312
public static List<String> inputs = Arrays.asList(
@@ -53,19 +52,4 @@ public class DataUnescapePartialQuoted {
5352
inputs.get(6).lastIndexOf(',')
5453
);
5554

56-
57-
/** inputs which contain one quote char (i.e. are missing an end quote) */
58-
public static List<String> inputsNoClosingQuote = Arrays.asList(
59-
"un\"closed",
60-
"\"abc,",
61-
"\""
62-
);
63-
64-
/** expected parse results for {@link #inputsNoClosingQuote} */
65-
public static List<String> expectedNoClosingQuote = Arrays.asList(
66-
"un\"closed",
67-
"\"abc,",
68-
"\""
69-
);
70-
7155
}

0 commit comments

Comments
 (0)