MCPcopy
hub / github.com/libgdx/libgdx / deleteTest

Method deleteTest

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

Test delete methods

()

Source from the content-addressed store, hash-verified

440
441 /** Test delete methods */
442 @Test
443 public void deleteTest () {
444 CharArray array = new CharArray("Hello World!");
445
446 // Delete range
447 array.delete(5, 11);
448 Assert.assertEquals("Hello!", array.toString());
449
450 // Delete char at
451 array.deleteCharAt(5);
452 Assert.assertEquals("Hello", array.toString());
453
454 // Delete all occurrences of char
455 array = new CharArray("Hello World!");
456 array.deleteAll('l');
457 Assert.assertEquals("Heo Word!", array.toString());
458
459 // Delete first occurrence of char
460 array = new CharArray("Hello World!");
461 array.deleteFirst('l');
462 Assert.assertEquals("Helo World!", array.toString());
463
464 // Delete all occurrences of string
465 array = new CharArray("Hello World! Hello!");
466 array.deleteAll("Hello");
467 Assert.assertEquals(" World! !", array.toString());
468
469 // Delete first occurrence of string
470 array = new CharArray("Hello World! Hello!");
471 array.deleteFirst("Hello");
472 Assert.assertEquals(" World! Hello!", array.toString());
473 }
474
475 /** Test replace methods */
476 @Test

Callers

nothing calls this directly

Calls 6

deleteMethod · 0.95
toStringMethod · 0.95
deleteCharAtMethod · 0.95
deleteAllMethod · 0.95
deleteFirstMethod · 0.95
assertEqualsMethod · 0.45

Tested by

no test coverage detected