Files
book-exercises/testing/tests/integration_tests.rs
Reality Enjoyer b8c7b5e68b finish testing
- convert project to a library by moving program logic into lib.rs
- create ./tests to store integration tests
- create ./common to store code we want shared across integration tests
2026-01-19 08:01:27 +00:00

25 lines
418 B
Rust

use testing::ops::*;
mod common;
#[test]
fn subtract_and_divide() {
let a = 20;
let b = 2;
let c = 3;
let difference = sub(&a, &b);
let quotient = div(&difference, &c);
assert_eq!(quotient, 6);
}
#[test]
fn add_and_multiply() {
let a = 10;
let b = common::give_me_5() as i32;
let c = 3;
let sum = add(&a, &b);
let product = mul(&sum, &c);
assert_eq!(product, 45);
}