@@ -688,6 +688,47 @@ func TestWorldStats(t *testing.T) {
688688 fmt .Println (s .String ())
689689}
690690
691+ func TestWorldStatsFlags (t * testing.T ) {
692+ w := NewWorld (128 , 32 )
693+
694+ posVelMap := NewMap2 [Position , Velocity ](& w )
695+ posVelHeadMap := NewMap3 [Position , Velocity , Heading ](& w )
696+ posChildMap := NewMap2 [Position , ChildOf ](& w )
697+
698+ posVelMap .NewBatchFn (100 , nil )
699+ posVelHeadMap .NewBatchFn (100 , nil )
700+
701+ parent := w .NewEntity ()
702+ child := posChildMap .NewEntityFn (nil , Rel [ChildOf ](parent ))
703+ w .RemoveEntity (child )
704+ w .RemoveEntity (parent )
705+
706+ s := w .Stats (stats .None )
707+ mem , memUsed := s .Memory , s .MemoryUsed
708+
709+ expectEqual (t , 4 , s .NumArchetypes )
710+ expectEqual (t , 0 , len (s .Archetypes ))
711+
712+ _ = w .Stats (stats .Archetypes )
713+ s = w .Stats (stats .Archetypes )
714+
715+ expectEqual (t , mem , s .Memory )
716+ expectEqual (t , memUsed , s .MemoryUsed )
717+ expectEqual (t , 4 , s .NumArchetypes )
718+ expectEqual (t , 4 , len (s .Archetypes ))
719+ expectEqual (t , 1 , s .Archetypes [0 ].NumTables )
720+ expectEqual (t , 0 , len (s .Archetypes [0 ].Tables ))
721+
722+ s = w .Stats (stats .All )
723+
724+ expectEqual (t , mem , s .Memory )
725+ expectEqual (t , memUsed , s .MemoryUsed )
726+ expectEqual (t , 4 , s .NumArchetypes )
727+ expectEqual (t , 4 , len (s .Archetypes ))
728+ expectEqual (t , 1 , s .Archetypes [0 ].NumTables )
729+ expectEqual (t , 1 , len (s .Archetypes [0 ].Tables ))
730+ }
731+
691732func TestWorldCreateManyTables (t * testing.T ) {
692733 n := 1000
693734
0 commit comments