Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
automainint committed Aug 16, 2024
1 parent 69292e0 commit ea92c2a
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "pgmer2"
version = "0.3.13"
version = "0.3.14"
edition = "2021"

[lib]
Expand Down
29 changes: 29 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,7 @@ fn mr_zerorec(
mod tests {
use pgrx::prelude::*;
use super::testing::*;
use std::time::SystemTime;

fn unpack_edge(x : &PgHeapTuple<'static, pgrx::AllocatedByRust>) -> (String, String, f64) {
return (
Expand Down Expand Up @@ -705,6 +706,34 @@ mod tests {
assert!(n < 120);
}

#[pg_test]
fn zerorec_reset_perf() {
let _ = crate::mr_reset().unwrap();

put_testing_edges();
let _ = crate::mr_zerorec(Some(true), None).unwrap();
let _ = crate::mr_reset().unwrap();
put_testing_edges();
let _ = crate::mr_create_context(Some("X")).unwrap();
let _ = crate::mr_create_context(Some("Y")).unwrap();
let _ = crate::mr_create_context(Some("Z")).unwrap();
let _ = crate::mr_zerorec(Some(true), None).unwrap();

let begin = SystemTime::now();
let get_time = || SystemTime::now().duration_since(begin).unwrap().as_millis();

let _ = crate::mr_graph(
Some("Uadeb43da4abb"),
Some("U000000000000"),
None,
Some(true),
None,
None
).unwrap();

assert!(get_time() < 10);
}

#[pg_test]
fn zerorec_scores() {
let _ = crate::mr_reset().unwrap();
Expand Down

0 comments on commit ea92c2a

Please sign in to comment.