refactor: Put tests in same module that defines struct (#685)

pull/24376/head
Andrew Lamb 2021-01-21 19:33:15 -05:00 committed by GitHub
parent 75b0a62fa5
commit 7cb512ef67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 29 deletions

View File

@ -155,32 +155,3 @@ pub trait DatabaseStore: Debug + Send + Sync {
//
//#[cfg(test)]
pub mod test;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_timestamp_range_contains() {
let range = TimestampRange::new(100, 200);
assert!(!range.contains(99));
assert!(range.contains(100));
assert!(range.contains(101));
assert!(range.contains(199));
assert!(!range.contains(200));
assert!(!range.contains(201));
}
#[test]
fn test_timestamp_range_contains_opt() {
let range = TimestampRange::new(100, 200);
assert!(!range.contains_opt(Some(99)));
assert!(range.contains_opt(Some(100)));
assert!(range.contains_opt(Some(101)));
assert!(range.contains_opt(Some(199)));
assert!(!range.contains_opt(Some(200)));
assert!(!range.contains_opt(Some(201)));
assert!(!range.contains_opt(None));
}
}

View File

@ -175,3 +175,32 @@ impl PredicateBuilder {
self.inner
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_timestamp_range_contains() {
let range = TimestampRange::new(100, 200);
assert!(!range.contains(99));
assert!(range.contains(100));
assert!(range.contains(101));
assert!(range.contains(199));
assert!(!range.contains(200));
assert!(!range.contains(201));
}
#[test]
fn test_timestamp_range_contains_opt() {
let range = TimestampRange::new(100, 200);
assert!(!range.contains_opt(Some(99)));
assert!(range.contains_opt(Some(100)));
assert!(range.contains_opt(Some(101)));
assert!(range.contains_opt(Some(199)));
assert!(!range.contains_opt(Some(200)));
assert!(!range.contains_opt(Some(201)));
assert!(!range.contains_opt(None));
}
}