@@ -124,3 +124,21 @@ await test(".equal deep", () => {
124
124
"Deeply nested composites c5 and c7 should not be equal due to differing additional properties" ,
125
125
) ;
126
126
} ) ;
127
+ await test ( ".equal composites decimal numbers" , ( ) => {
128
+ const c1 = Composite ( { a : 2.0 } ) ;
129
+ const c2 = Composite ( { a : 2.5 } ) ;
130
+ assert ( c1 !== c2 , "c1 and c2 should not be the same object" ) ;
131
+ assert ( ! Composite . equal ( c1 , c2 ) , "c1 and c2 should not be equal" ) ;
132
+ const c3 = Composite ( { a : 2.5 } ) ;
133
+ assert ( c2 !== c3 , "c2 and c3 should not be the same object" ) ;
134
+ assert ( Composite . equal ( c2 , c3 ) , "c2 and c3 should be equal" ) ;
135
+ } ) ;
136
+ await test ( ".equal composites interesting decimal numbers" , ( ) => {
137
+ const c1 = Composite ( { a : 1 + Number . EPSILON } ) ;
138
+ const c2 = Composite ( { a : 1 + 2 * Number . EPSILON } ) ;
139
+ assert ( c1 !== c2 , "c1 and c2 should not be the same object" ) ;
140
+ assert ( ! Composite . equal ( c1 , c2 ) , "c1 and c2 should not be equal" ) ;
141
+ const c3 = Composite ( { a : 1 + 2 * Number . EPSILON } ) ;
142
+ assert ( c2 !== c3 , "c2 and c3 should not be the same object" ) ;
143
+ assert ( Composite . equal ( c2 , c3 ) , "c2 and c3 should be equal" ) ;
144
+ } ) ;
0 commit comments