-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
193 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1 @@ | ||
use forky_core::*; | ||
use sweet::*; | ||
|
||
|
||
#[sweet_test] | ||
pub fn f32() -> Result<()> { | ||
expect(f32::lerp(1., 2., 0.5)).to_be(1.5)?; | ||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use flume::Receiver; | ||
use flume::Sender; | ||
use flume::TryRecvError; | ||
|
||
|
||
|
||
pub fn mock_value<T>() -> MockValue<T> { MockValue::new() } | ||
|
||
#[derive(Debug, Clone)] | ||
pub struct MockValue<T> { | ||
pub send: Sender<T>, | ||
pub recv: Receiver<T>, | ||
} | ||
|
||
impl<T> Default for MockValue<T> { | ||
fn default() -> Self { Self::new() } | ||
} | ||
|
||
impl<T> MockValue<T> { | ||
pub fn new() -> Self { | ||
let (send, recv) = flume::unbounded(); | ||
Self { send, recv } | ||
} | ||
pub fn push(&self, value: T) { | ||
self.send | ||
.send(value) | ||
.expect("the channel has been disconnected"); | ||
} | ||
|
||
pub fn pop(&self) -> Option<T> { | ||
match self.recv.try_recv() { | ||
Ok(value) => Some(value), | ||
Err(TryRecvError::Empty) => None, | ||
Err(TryRecvError::Disconnected) => { | ||
panic!("the channel has been disconnected") | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.