@@ -456,8 +456,9 @@ mod tests {
456
456
assert ! ( cmp( result. to_f64( ) , 6f64 ) ) ;
457
457
}
458
458
459
+ // Test scripts and results to compare methods: https://www.genivia.com/files/qthsh.zip
459
460
#[ test]
460
- fn test_integrate ( ) {
461
+ fn test_integrate_data ( ) {
461
462
let test_data = [
462
463
( "integral(0,1,1/sqrt(x),dx)" , "2" ) ,
463
464
( "integral(0,2,sqrt(4-(x^2)),dx)" , "3.141592654" ) ,
@@ -1299,17 +1300,22 @@ mod tests {
1299
1300
) ;
1300
1301
assert ! ( cmp( result. to_f64( ) , i. 1 . parse:: <f64 >( ) . unwrap( ) ) ) ;
1301
1302
}
1303
+ }
1302
1304
1303
- //let result = super::integrate(
1304
- // &mut context,
1305
- // &f64_to_float_literal(2f64),
1306
- // &f64_to_float_literal(4f64),
1307
- // &var("x"),
1308
- // "x",
1309
- //)
1310
- //.unwrap();
1305
+ #[ test]
1306
+ fn test_integrate_function ( ) {
1307
+ let mut symbol_table = SymbolTable :: new ( ) ;
1308
+ let mut context = get_context ( & mut symbol_table) ;
1309
+ let result = super :: integrate (
1310
+ & mut context,
1311
+ & f64_to_float_literal ( 2f64 ) ,
1312
+ & f64_to_float_literal ( 4f64 ) ,
1313
+ & var ( "x" ) ,
1314
+ "x" ,
1315
+ )
1316
+ . unwrap ( ) ;
1311
1317
1312
- // assert!(cmp(result.to_f64(), 6f64));
1318
+ assert ! ( cmp( result. to_f64( ) , 6f64 ) ) ;
1313
1319
}
1314
1320
1315
1321
#[ test]
0 commit comments