-
-
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
22 changed files
with
149 additions
and
83 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use bevy_math::prelude::*; | ||
use forky_bevy::prelude::*; | ||
use sweet::*; | ||
|
||
#[sweet_test] | ||
pub fn works() -> Result<()> { | ||
for i in 0..10 { | ||
let val = Vec3::random_in_cube(); | ||
expect(val.length()).to_be_less_than(1.5)?; | ||
// println!("random_in_cube: {val}"); | ||
} | ||
for i in 0..10 { | ||
let val = Vec3::random_on_sphere(); | ||
expect(val.length()).to_be_close_to(1.)?; | ||
// println!("random_on_sphere: {val}"); | ||
} | ||
for i in 0..10 { | ||
let val = Vec3::random_in_sphere(); | ||
expect(val.length()).to_be_less_than(1.)?; | ||
// println!("random_in_sphere: {val}"); | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
use extend::ext; | ||
use std::i32; | ||
|
||
#[ext] | ||
pub impl Option<&i32> { | ||
fn or_default(&self) -> &i32 { | ||
match &self { | ||
Some(c) => c, | ||
None => &0, | ||
} | ||
pub impl f32 { | ||
fn lerp(start: Self, end: Self, t: Self) -> Self { | ||
start + (end - start) * t | ||
} | ||
} |
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 +0,0 @@ | ||
pub fn min(a: f32, b: f32) -> f32 { a.min(b) } | ||
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,5 +1,6 @@ | ||
use rand::Rng; | ||
|
||
|
||
/// Returns a random value between 0.0 and 1.0 | ||
pub fn random_value() -> f32 { rand::thread_rng().gen_range(0.0..1.0) } | ||
pub fn random_signed() -> f32 { rand::thread_rng().gen_range(-1.0..1.0) } | ||
pub fn random_percent_i32() -> i32 { rand::thread_rng().gen_range(0..100) } |
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use forky_core::*; | ||
use sweet::*; | ||
|
||
#[sweet_test] | ||
pub fn i32() -> Result<()> { | ||
let a = 1; | ||
let _a = Some(&a); | ||
expect(*_a.unwrap()).to_be(1)?; | ||
expect(*_a.or_default()).to_be(1)?; | ||
let _a: Option<&i32> = None; | ||
expect(*_a.or_default()).to_be(0)?; | ||
|
||
Ok(()) | ||
} | ||
|
||
|
||
|
||
#[sweet_test] | ||
pub fn works() -> 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
Oops, something went wrong.