Skip to content

Commit d65ae1a

Browse files
committed
chore: bring integrate_function back
1 parent 34527ff commit d65ae1a

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

kalk/src/numerical.rs

+16-10
Original file line numberDiff line numberDiff line change
@@ -456,8 +456,9 @@ mod tests {
456456
assert!(cmp(result.to_f64(), 6f64));
457457
}
458458

459+
// Test scripts and results to compare methods: https://www.genivia.com/files/qthsh.zip
459460
#[test]
460-
fn test_integrate() {
461+
fn test_integrate_data() {
461462
let test_data = [
462463
("integral(0,1,1/sqrt(x),dx)","2"),
463464
("integral(0,2,sqrt(4-(x^2)),dx)","3.141592654"),
@@ -1299,17 +1300,22 @@ mod tests {
12991300
);
13001301
assert!(cmp(result.to_f64(), i.1.parse::<f64>().unwrap()));
13011302
}
1303+
}
13021304

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();
13111317

1312-
//assert!(cmp(result.to_f64(), 6f64));
1318+
assert!(cmp(result.to_f64(), 6f64));
13131319
}
13141320

13151321
#[test]

0 commit comments

Comments
 (0)