-
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
1e568dc
commit c2d41e8
Showing
4 changed files
with
115 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,66 @@ | ||
use pretty_assertions::assert_eq; | ||
use rstest::rstest; | ||
|
||
use crate::utils::is_subsequence; | ||
|
||
#[rstest] | ||
#[case::empty(&[], &[], true)] | ||
#[case::empty_subsequence(&[], &["a".to_string(), "b".to_string()], true)] | ||
#[case::empty_sequence(&["a".to_string()], &[], false)] | ||
#[case::subsequence_1( | ||
&["a".to_string()], | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
true | ||
)] | ||
#[case::subsequence_1( | ||
&["b".to_string()], | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
true | ||
)] | ||
#[case::subsequence_1( | ||
&["c".to_string()], | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
true | ||
)] | ||
#[case::subsequence_4( | ||
&["a".to_string(), "b".to_string()], | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
true | ||
)] | ||
#[case::subsequence_5( | ||
&["a".to_string(), "c".to_string()], | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
true | ||
)] | ||
#[case::subsequence_6( | ||
&["b".to_string(), "c".to_string()], | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
true | ||
)] | ||
#[case::subsequence_7( | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
true | ||
)] | ||
#[case::out_of_order_1( | ||
&["b".to_string(), "a".to_string()], | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
false | ||
)] | ||
#[case::out_of_order_2( | ||
&["b".to_string(), "a".to_string(), "c".to_string()], | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
false | ||
)] | ||
#[case::unrelated( | ||
&["a".to_string(), "b".to_string(), "d".to_string()], | ||
&["a".to_string(), "b".to_string(), "c".to_string()], | ||
false | ||
)] | ||
fn test_is_subsequence( | ||
#[case] subsequence: &[String], | ||
#[case] sequence: &[String], | ||
#[case] expected_result: bool, | ||
) { | ||
assert_eq!(is_subsequence(subsequence, sequence), expected_result); | ||
} |