A lot of changes. Main ones are:

- fraction type renamed as FractionType and moved from operator-fraction.go to fraction-type.go
- ListType moved from operator-list.go to list-type.go
- all test file were renamed adding the "t_" prefix
- defined a test template in file t_temple_test.go
- new test file t_relational_test.go where relational tests are collected
- lists can now compared as set using operators <, <=, >, and >= (IMPORTANT: here = menas same content, not same list)
This commit is contained in:
2024-05-28 07:26:05 +02:00
parent 78cbb7b36f
commit 3736214c5a
25 changed files with 722 additions and 554 deletions
+6 -6
View File
@@ -21,7 +21,7 @@ func doAdd(ctx ExprContext, name string, it Iterator, count, level int) (result
var sumAsFloat, sumAsFract bool
var floatSum float64 = 0.0
var intSum int64 = 0
var fractSum *fraction
var fractSum *FractionType
var v any
level++
@@ -61,9 +61,9 @@ func doAdd(ctx ExprContext, name string, it Iterator, count, level int) (result
if sumAsFloat {
floatSum += numAsFloat(v)
} else if sumAsFract {
var item *fraction
var item *FractionType
var ok bool
if item, ok = v.(*fraction); !ok {
if item, ok = v.(*FractionType); !ok {
iv, _ := v.(int64)
item = newFraction(iv, 1)
}
@@ -95,7 +95,7 @@ func doMul(ctx ExprContext, name string, it Iterator, count, level int) (result
var mulAsFloat, mulAsFract bool
var floatProd float64 = 1.0
var intProd int64 = 1
var fractProd *fraction
var fractProd *FractionType
var v any
level++
@@ -136,9 +136,9 @@ func doMul(ctx ExprContext, name string, it Iterator, count, level int) (result
if mulAsFloat {
floatProd *= numAsFloat(v)
} else if mulAsFract {
var item *fraction
var item *FractionType
var ok bool
if item, ok = v.(*fraction); !ok {
if item, ok = v.(*FractionType); !ok {
iv, _ := v.(int64)
item = newFraction(iv, 1)
}