-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: declare post compilation builtin validation
- Loading branch information
1 parent
6734b2d
commit ab76a25
Showing
4 changed files
with
133 additions
and
2 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
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,78 @@ | ||
use pretty_assertions::assert_eq; | ||
use rstest::rstest; | ||
|
||
use crate::utils::is_subsequence; | ||
|
||
#[rstest] | ||
#[case::empty( | ||
&[], | ||
&[], | ||
true | ||
)] | ||
#[case::empty_subsequence( | ||
&[], | ||
&["a", "b"], | ||
true | ||
)] | ||
#[case::empty_sequence( | ||
&["a"], | ||
&[], | ||
false | ||
)] | ||
#[case::subsequence_1( | ||
&["a"], | ||
&["a", "b", "c"], | ||
true | ||
)] | ||
#[case::subsequence_1( | ||
&["b"], | ||
&["a", "b", "c"], | ||
true | ||
)] | ||
#[case::subsequence_1( | ||
&["c"], | ||
&["a", "b", "c"], | ||
true | ||
)] | ||
#[case::subsequence_4( | ||
&["a", "b"], | ||
&["a", "b", "c"], | ||
true | ||
)] | ||
#[case::subsequence_5( | ||
&["a", "c"], | ||
&["a", "b", "c"], | ||
true | ||
)] | ||
#[case::subsequence_6( | ||
&["b", "c"], | ||
&["a", "b", "c"], | ||
true | ||
)] | ||
#[case::subsequence_7( | ||
&["a", "b", "c"], | ||
&["a", "b", "c"], | ||
true | ||
)] | ||
#[case::out_of_order_1( | ||
&["b", "a"], | ||
&["a", "b", "c"], | ||
false | ||
)] | ||
#[case::out_of_order_2( | ||
&["b", "a", "c"], | ||
&["a", "b", "c"], | ||
false | ||
)] | ||
#[case::unrelated( | ||
&["a", "b", "d"], | ||
&["a", "b", "c"], | ||
false | ||
)] | ||
fn test_is_subsequence( | ||
#[case] subsequence: &[&str], | ||
#[case] sequence: &[&str], | ||
#[case] expected_result: bool, | ||
) { | ||
assert_eq!(is_subsequence(subsequence, sequence), expected_result); | ||
} |