MCPcopy
hub / github.com/libgdx/libgdx / stackTest

Method stackTest

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

Test stack operations

()

Source from the content-addressed store, hash-verified

243
244 /** Test stack operations */
245 @Test
246 public void stackTest () {
247 CharArray array = new CharArray();
248
249 // Push (add)
250 array.add('a');
251 array.add('b');
252 array.add('c');
253
254 // Pop
255 Assert.assertEquals('c', array.pop());
256 Assert.assertEquals(2, array.size);
257
258 // Peek
259 Assert.assertEquals('b', array.peek());
260 Assert.assertEquals(2, array.size); // Size shouldn't change
261
262 // First
263 Assert.assertEquals('a', array.first());
264
265 // Empty checks
266 Assert.assertTrue(array.notEmpty());
267 Assert.assertFalse(array.isEmpty());
268
269 array.clear();
270 Assert.assertFalse(array.notEmpty());
271 Assert.assertTrue(array.isEmpty());
272 }
273
274 /** Test array operations */
275 @Test

Callers

nothing calls this directly

Calls 8

addMethod · 0.95
popMethod · 0.95
peekMethod · 0.95
firstMethod · 0.95
notEmptyMethod · 0.95
isEmptyMethod · 0.95
clearMethod · 0.95
assertEqualsMethod · 0.45

Tested by

no test coverage detected