Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cyclic dependency between test-utils and hyperdrive-math crates #92

Merged
merged 8 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 1 addition & 6 deletions crates/hyperdrive-math/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
[package]

name = "hyperdrive-math"
version = {workspace=true}
version = { workspace = true }
edition = "2021"

[[test]]

name = "integration-tests"
path = "tests/integration_tests.rs"

[dependencies]

# External dependencies
Expand Down
2 changes: 2 additions & 0 deletions crates/hyperdrive-math/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
mod long;
mod lp;
mod short;
#[cfg(test)]
mod test_utils;
mod utils;
mod yield_space;

Expand Down
3 changes: 2 additions & 1 deletion crates/hyperdrive-math/src/long/max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ mod tests {
use tracing_test::traced_test;

use super::*;
use crate::calculate_effective_share_reserves;
use crate::{calculate_effective_share_reserves, test_utils::agent::HyperdriveMathAgent};

/// This test differentially fuzzes the `absolute_max_long` function against
/// the Solidity analogue `calculateAbsoluteMaxLong`.
Expand Down Expand Up @@ -696,6 +696,7 @@ mod tests {
let chain = TestChain::new().await?;
let mut alice = chain.alice().await?;
let mut bob = chain.bob().await?;

let config = bob.get_config().clone();

for _ in 0..*FUZZ_RUNS {
Expand Down
1 change: 1 addition & 0 deletions crates/hyperdrive-math/src/long/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ mod tests {
};

use super::*;
use crate::test_utils::agent::HyperdriveMathAgent;

/// Executes random trades throughout a Hyperdrive term.
async fn preamble(
Expand Down
1 change: 1 addition & 0 deletions crates/hyperdrive-math/src/long/targeted.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ mod tests {
use tracing_test::traced_test;

use super::*;
use crate::test_utils::agent::HyperdriveMathAgent;

#[ignore]
#[traced_test]
Expand Down
1 change: 1 addition & 0 deletions crates/hyperdrive-math/src/lp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ mod tests {
};

use super::*;
use crate::test_utils::agent::HyperdriveMathAgent;

#[tokio::test]
async fn fuzz_test_calculate_initial_reserves() -> Result<()> {
Expand Down
1 change: 1 addition & 0 deletions crates/hyperdrive-math/src/short/max.rs
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ mod tests {
use tracing_test::traced_test;

use super::*;
use crate::test_utils::agent::HyperdriveMathAgent;

/// This test differentially fuzzes the `calculate_max_short` function against
/// the Solidity analogue `calculateMaxShort`. `calculateMaxShort` doesn't take
Expand Down
1 change: 1 addition & 0 deletions crates/hyperdrive-math/src/short/open.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ mod tests {
use tracing_test::traced_test;

use super::*;
use crate::test_utils::agent::HyperdriveMathAgent;

/// Executes random trades throughout a Hyperdrive term.
async fn preamble(
Expand Down
3 changes: 3 additions & 0 deletions crates/hyperdrive-math/src/test_utils.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#[cfg(test)]
pub mod agent;
mod integration_tests;
Loading
Loading