You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.5 KiB
55 lines
1.5 KiB
package TestUnit
|
|
|
|
import (
|
|
"goUpload/utils"
|
|
"log"
|
|
"testing"
|
|
)
|
|
|
|
func Test_formulaTemplate_demo1(t *testing.T) {
|
|
//公式表达式计算
|
|
formula := "(1.1*2 + 5/2)+ 2.4/2 + 0.8"
|
|
result := utils.CalculateFormula(formula)
|
|
log.Printf("表达式 %s =>计算结果=%v", formula, result)
|
|
}
|
|
|
|
func Test_formulaTemplate_demo2(t *testing.T) {
|
|
//公式表达式计算
|
|
formula := "2² + 0.8"
|
|
result := utils.CalculateFormula(formula)
|
|
log.Printf("表达式 %s =>计算结果=%v", formula, result)
|
|
}
|
|
|
|
func Test_formulaTemplate_demo3(t *testing.T) {
|
|
//公式表达式计算
|
|
formula := "(1.1*2 + 5/2)+ 2.4/2² + 0.8"
|
|
result := utils.CalculateFormula(formula)
|
|
log.Printf("表达式 %s =>计算结果=%v", formula, result)
|
|
}
|
|
|
|
func Test_formulaTemplate_demo4(t *testing.T) {
|
|
//公式表达式计算 √
|
|
formula := "√4 + 0.8"
|
|
result := utils.CalculateFormula(formula)
|
|
log.Printf("表达式 %s =>计算结果=%v", formula, result)
|
|
}
|
|
|
|
func Test_formulaTemplate_demo5(t *testing.T) {
|
|
//公式表达式计算 √
|
|
formula := "√4+12 + 0.8"
|
|
result := utils.CalculateFormula(formula)
|
|
log.Printf("表达式 %s =>计算结果=%v", formula, result)
|
|
}
|
|
func Test_formulaTemplate_demo6(t *testing.T) {
|
|
//公式表达式计算 √
|
|
formula := "3*√4*5 + 0.8"
|
|
result := utils.CalculateFormula(formula)
|
|
log.Printf("表达式 %s =>计算结果=%v", formula, result)
|
|
}
|
|
|
|
func Test_formulaTemplate_demo7(t *testing.T) {
|
|
//公式表达式计算 √
|
|
formula := "3*√(2*8) + 0.8"
|
|
result := utils.CalculateFormula(formula)
|
|
log.Printf("表达式 %s =>计算结果=%v", formula, result)
|
|
}
|
|
|