You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expected: 99.01000213623047, // The nearest IEEE754 float32 value of 99.01 is 99.01000213623047; which are not equal (while using ==). Need suggestions for precesion float value.
133
-
// one way to solve the comparison using convertFloat(string with float precesion)==float64
132
+
expected: 99.01000213623047, // The nearest IEEE754 float32 value of 99.01 is 99.01000213623047; which are not equal (while using ==). Need suggestions for precision float value.
133
+
// one way to solve the comparison using convertFloat(string with float precision)==float64
expected:=`[{"id":null,"name":"HP core i3 SSD","price":850},{"id":4,"name":"Fujitsu","price":850},{"id":5,"key":2300,"name":"HP core i5","price":850},{"id":6,"name":"HP core i7","price":950},{"id":3,"name":"Sony VAIO","price":1200},{"id":1,"name":"MacBook Pro 13 inch retina","price":1350},{"id":2,"name":"MacBook Pro 15 inch retina","price":1700}]`
515
515
out:=jq.Get()
516
-
assertJSON(t, out, expected, "sorring array of object by its key (price-float64) in ascending desc")
516
+
assertJSON(t, out, expected, "sorting array of object by its key (price-float64) in ascending desc")
expected:=`[{"id":2,"name":"MacBook Pro 15 inch retina","price":1700},{"id":1,"name":"MacBook Pro 13 inch retina","price":1350},{"id":3,"name":"Sony VAIO","price":1200},{"id":6,"name":"HP core i7","price":950},{"id":4,"name":"Fujitsu","price":850},{"id":5,"key":2300,"name":"HP core i5","price":850},{"id":null,"name":"HP core i3 SSD","price":850}]`
524
524
out:=jq.Get()
525
-
assertJSON(t, out, expected, "sorring array of object by its key (price-float64) in descending desc")
525
+
assertJSON(t, out, expected, "sorting array of object by its key (price-float64) in descending desc")
expected:=`[{"id":4,"name":"Fujitsu","price":850},{"id":null,"name":"HP core i3 SSD","price":850},{"id":5,"key":2300,"name":"HP core i5","price":850},{"id":6,"name":"HP core i7","price":950},{"id":1,"name":"MacBook Pro 13 inch retina","price":1350},{"id":2,"name":"MacBook Pro 15 inch retina","price":1700},{"id":3,"name":"Sony VAIO","price":1200}]`
533
533
out:=jq.Get()
534
-
assertJSON(t, out, expected, "sorring array of object by its key (name-string) in ascending desc")
534
+
assertJSON(t, out, expected, "sorting array of object by its key (name-string) in ascending desc")
expected:=`[{"id":3,"name":"Sony VAIO","price":1200},{"id":2,"name":"MacBook Pro 15 inch retina","price":1700},{"id":1,"name":"MacBook Pro 13 inch retina","price":1350},{"id":6,"name":"HP core i7","price":950},{"id":5,"key":2300,"name":"HP core i5","price":850},{"id":null,"name":"HP core i3 SSD","price":850},{"id":4,"name":"Fujitsu","price":850}]`
542
542
out:=jq.Get()
543
-
assertJSON(t, out, expected, "sorring array of object by its key (name-string) in descending desc")
543
+
assertJSON(t, out, expected, "sorting array of object by its key (name-string) in descending desc")
0 commit comments