File tree Expand file tree Collapse file tree 3 files changed +24
-62
lines changed Expand file tree Collapse file tree 3 files changed +24
-62
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -52,4 +52,28 @@ impl EntityChange {
5252 pub fn component ( & self ) -> ComponentId {
5353 self . component
5454 }
55+ }
56+
57+ mod tests {
58+ use crate :: component:: ComponentId ;
59+ use crate :: entity:: Entity ;
60+ use crate :: storage:: { Changes , EntityChange } ;
61+
62+ #[ test]
63+ fn changes ( ) {
64+ let mut storage = Changes :: new ( ) ;
65+ let entity = Entity :: PLACEHOLDER ;
66+ let component = ComponentId :: new ( 1 ) ;
67+ storage. push ( EntityChange :: new ( entity, component) ) ;
68+ storage. push ( EntityChange :: new ( entity, component) ) ;
69+
70+ let changes = storage. take_all ( ) ;
71+ assert_eq ! ( changes. len( ) , 2 ) ;
72+ assert_eq ! ( storage. take_all( ) . len( ) , 0 ) ;
73+
74+ changes. iter ( ) . for_each ( |change| {
75+ assert_eq ! ( change. component, component) ;
76+ assert_eq ! ( change. entity, entity) ;
77+ } )
78+ }
5579}
Original file line number Diff line number Diff line change @@ -136,14 +136,6 @@ pub struct World {
136136 pub ( crate ) command_queue : RawCommandQueue ,
137137}
138138
139- impl World {
140-
141- /// Just For Test
142- pub fn test ( & mut self ) -> & mut Changes {
143- & mut self . storages . changes
144- }
145- }
146-
147139impl Default for World {
148140 fn default ( ) -> Self {
149141 let mut world = Self {
You can’t perform that action at this time.
0 commit comments