qstommyshu commented on PR #15578:
URL: https://github.com/apache/datafusion/pull/15578#issuecomment-2779584934
Also, I found the test cases are a bit here and there, but I think the sql
test suite are too large to restructure now. I'm thinking maybe we can try to
use modules to separate different tests in future?
Here is an example:
```Rust
pub fn add(a: i32, b: i32) -> i32 {
a + b
}
pub fn multiply(a: i32, b: i32) -> i32 {
a * b
}
#[cfg(test)]
mod tests {
use super::*;
// add test module
mod add_tests {
use super::*;
#[test]
fn test_add_positive() {
assert_eq!(add(2, 3), 5);
}
#[test]
fn test_add_negative() {
assert_eq!(add(-2, -3), -5);
}
}
// multiply test module
mod multiply_tests {
use super::*;
#[test]
fn test_multiply_positive() {
assert_eq!(multiply(4, 5), 20);
}
#[test]
fn test_multiply_mixed() {
assert_eq!(multiply(-3, 6), -18);
}
}
// integration test module
mod integration_tests {
use super::*;
#[test]
fn test_combined_operations() {
let sum = add(2, 3);
let product = multiply(sum, 4);
assert_eq!(product, 20);
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]