Skip to content

Commit

Permalink
add reverse tests
Browse files Browse the repository at this point in the history
  • Loading branch information
texadactyl committed Aug 8, 2024
1 parent d0a1a2c commit c5aceec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/stringbuffer-misc/main.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ public static void main(String[] args) {
errorCount += checker("sb1.length(35)", 35, sb1.length());

sb1 = new StringBuffer("ABCDEFGHIJKLMNOPQRSTUVWXYZxyz");
sb1.reverse();
errorCount += checker("sb1.reverse()", "zyxZYXWVUTSRQPONMLKJIHGFEDCBA", sb1.toString());
sb1.reverse();
StringBuffer sb2 = new StringBuffer("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
System.out.printf("sb1: %s\n", sb1);
System.out.printf("sb2: %s\n", sb2);
Expand Down
5 changes: 4 additions & 1 deletion tests/stringbuilder-misc/main.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ public static void main(String[] args) {
errorCount += checker("sb1.capacity(42)", 42, sb1.capacity());
errorCount += checker("sb1.length(35)", 35, sb1.length());

sb1 = new StringBuilder("ABCDEFGHIJKLMNOPQRSTUVWXYZxyz");
sb1 = new StringBuilder("ABCDEFGHIJKLMNOPQRSTUVWXYZxyz");
sb1.reverse();
errorCount += checker("sb1.reverse()", "zyxZYXWVUTSRQPONMLKJIHGFEDCBA", sb1.toString());
sb1.reverse();
StringBuilder sb2 = new StringBuilder("ABCDEFGHIJKLMNOPQRSTUVWXYZ");
System.out.printf("sb1: %s\n", sb1);
System.out.printf("sb2: %s\n", sb2);
Expand Down

0 comments on commit c5aceec

Please sign in to comment.