MCPcopy
hub / github.com/libgdx/libgdx / insertTest

Method insertTest

gdx/test/com/badlogic/gdx/utils/CharArrayTest.java:513–551  ·  view source on GitHub ↗

Test insert methods

()

Source from the content-addressed store, hash-verified

511
512 /** Test insert methods */
513 @Test
514 public void insertTest () {
515 CharArray array = new CharArray("Hello!");
516
517 // Insert char
518 array.insert(5, ' ');
519 Assert.assertEquals("Hello !", array.toString());
520
521 // Insert string
522 array.insert(6, "World");
523 Assert.assertEquals("Hello World!", array.toString());
524
525 // Insert at beginning
526 array.insert(0, "Say ");
527 Assert.assertEquals("Say Hello World!", array.toString());
528
529 // Insert boolean
530 array = new CharArray("Value: ");
531 array.insert(7, true);
532 Assert.assertEquals("Value: true", array.toString());
533
534 // Insert numbers
535 array = new CharArray("Number: ");
536 array.insert(8, 42);
537 Assert.assertEquals("Number: 42", array.toString());
538
539 // Insert char array
540 array = new CharArray("AB");
541 char[] chars = {'C', 'D', 'E'};
542 array.insert(1, chars);
543 Assert.assertEquals("ACDEB", array.toString());
544
545 // Insert range
546 array = new CharArray("AC");
547 array.insertRange(1, 2);
548 array.set(1, 'B');
549 array.set(2, 'B');
550 Assert.assertEquals("ABBC", array.toString());
551 }
552
553 /** Test substring methods */
554 @Test

Callers

nothing calls this directly

Calls 5

insertMethod · 0.95
toStringMethod · 0.95
insertRangeMethod · 0.95
setMethod · 0.95
assertEqualsMethod · 0.45

Tested by

no test coverage detected