@@ -322,6 +322,7 @@ public void testEnsureCapacity()
322
322
{
323
323
TightRandomResizingStrategy resizer = new TightRandomResizingStrategy (0 );
324
324
KTypeArrayList <KType > list = new KTypeArrayList <>(0 , resizer );
325
+ assertEquals (list .size (), list .buffer .length );
325
326
326
327
// Add some elements.
327
328
final int max = rarely () ? 0 : randomIntBetween (0 , 1000 );
@@ -390,6 +391,7 @@ public void testGrowth()
390
391
391
392
list = new KTypeArrayList <KType >(0 ,
392
393
new BoundedProportionalArraySizingStrategy (5 , maxGrowth , 2 ));
394
+ assertEquals (list .size (), list .buffer .length );
393
395
394
396
for (int i = 0 ; i < count ; i ++)
395
397
list .add (cast (i ));
@@ -492,9 +494,21 @@ public void testClear()
492
494
@ Test
493
495
public void testFrom ()
494
496
{
495
- KTypeArrayList <KType > variable = KTypeArrayList .from (k1 , k2 , k3 );
496
- assertEquals (3 , variable .size ());
497
- assertListEquals (variable .toArray (), 1 , 2 , 3 );
497
+ list = KTypeArrayList .from (k1 , k2 , k3 );
498
+ assertEquals (3 , list .size ());
499
+ assertListEquals (list .toArray (), 1 , 2 , 3 );
500
+ assertEquals (list .size (), list .buffer .length );
501
+ }
502
+
503
+ /* */
504
+ @ Test
505
+ public void testCopyContainer ()
506
+ {
507
+ list .add (asArray ( 1 , 2 , 3 ));
508
+ KTypeArrayList <KType > copy = new KTypeArrayList <KType >(list );
509
+ assertEquals (3 , copy .size ());
510
+ assertListEquals (copy .toArray (), 1 , 2 , 3 );
511
+ assertEquals (copy .size (), copy .buffer .length );
498
512
}
499
513
500
514
/* */
0 commit comments