-
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.
Bumped version to 1.11.0, Added these methods to
BoolWitG
:
- is_true - is_false - to_true - to_false - unwrap_true - unwrap_false Added tests for these methods Relaxed `Copy + Clone + Debug` impls of `BooleanWitG` to work for any `<B> BooleanWitG<B>`, instead of requirning `<const B: bool> BoolWitG<Bool<B>>`. Updated what non-proc_macro UI tests output Updated changelog
- Loading branch information
1 parent
82fd8a2
commit 2e4911b
Showing
16 changed files
with
300 additions
and
59 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
[package] | ||
name = "typewit" | ||
<<<<<<< HEAD | ||
version = "1.10.0" | ||
======= | ||
version = "1.10.1" | ||
>>>>>>> main | ||
version = "1.11.0" | ||
authors = ["rodrimati1992 <[email protected]>"] | ||
rust-version = "1.57.0" | ||
edition = "2021" | ||
|
@@ -51,12 +47,7 @@ alloc = [] | |
mut_refs = ["rust_stable"] | ||
nightly_mut_refs = ["mut_refs"] | ||
docsrs = [] | ||
<<<<<<< HEAD | ||
|
||
__ui_tests = [] | ||
======= | ||
__ui_tests = ["trybuild"] | ||
>>>>>>> main | ||
|
||
[package.metadata.docs.rs] | ||
features = ["alloc", "rust_stable", "adt_const_marker", "docsrs"] | ||
|
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,80 @@ | ||
use typewit::const_marker::{Bool, BoolWitG}; | ||
use typewit::TypeEq; | ||
|
||
#[test] | ||
fn is_true_test() { | ||
const fn inner<B>(wit: BoolWitG<B>) -> bool { | ||
wit.is_true() | ||
} | ||
|
||
assert!(inner(BoolWitG::True(TypeEq::NEW))); | ||
assert!(!inner(BoolWitG::False(TypeEq::NEW))); | ||
} | ||
|
||
#[test] | ||
fn is_false_test() { | ||
const fn inner<B>(wit: BoolWitG<B>) -> bool { | ||
wit.is_false() | ||
} | ||
|
||
assert!(!inner(BoolWitG::True(TypeEq::NEW))); | ||
assert!(inner(BoolWitG::False(TypeEq::NEW))); | ||
} | ||
|
||
#[test] | ||
fn to_true_test() { | ||
const fn inner<B>(wit: BoolWitG<B>) -> Option<TypeEq<B, Bool<true>>> { | ||
wit.to_true() | ||
} | ||
|
||
assert_eq!(inner(BoolWitG::True(TypeEq::NEW)), Some(TypeEq::new::<Bool<true>>())); | ||
assert_eq!(inner(BoolWitG::False(TypeEq::NEW)), None); | ||
} | ||
|
||
#[test] | ||
fn to_false_test() { | ||
const fn inner<B>(wit: BoolWitG<B>) -> Option<TypeEq<B, Bool<false>>> { | ||
wit.to_false() | ||
} | ||
|
||
assert_eq!(inner(BoolWitG::True(TypeEq::NEW)), None); | ||
assert_eq!(inner(BoolWitG::False(TypeEq::NEW)), Some(TypeEq::new::<Bool<false>>())); | ||
} | ||
|
||
#[test] | ||
fn unwrap_true_test() { | ||
const fn inner<B>(wit: BoolWitG<B>) -> TypeEq<B, Bool<true>> { | ||
wit.unwrap_true() | ||
} | ||
|
||
assert_eq!(inner(BoolWitG::True(TypeEq::NEW)), TypeEq::new::<Bool<true>>()); | ||
} | ||
|
||
#[test] | ||
#[should_panic] | ||
fn unwrap_true_on_false_test() { | ||
const fn inner<B>(wit: BoolWitG<B>) -> TypeEq<B, Bool<true>> { | ||
wit.unwrap_true() | ||
} | ||
|
||
let _ = inner(BoolWitG::False(TypeEq::NEW)); | ||
} | ||
|
||
#[test] | ||
fn unwrap_false_test() { | ||
const fn inner<B>(wit: BoolWitG<B>) -> TypeEq<B, Bool<false>> { | ||
wit.unwrap_false() | ||
} | ||
|
||
assert_eq!(inner(BoolWitG::False(TypeEq::NEW)), TypeEq::new::<Bool<false>>()); | ||
} | ||
|
||
#[test] | ||
#[should_panic] | ||
fn unwrap_false_on_true_test() { | ||
const fn inner<B>(wit: BoolWitG<B>) -> TypeEq<B, Bool<false>> { | ||
wit.unwrap_false() | ||
} | ||
|
||
let _ = inner(BoolWitG::True(TypeEq::NEW)); | ||
} |
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
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.