proptest 추가#7
Conversation
|
| [dev-dependencies] | ||
| csv = "1.3.0" | ||
| serde_json = "^1" | ||
| proptest = "1.5" |
There was a problem hiding this comment.
찾아보니 proptest의 경우 1.7.0이 최신 버전이니 1.5에서 1.7 으로 변경하면 어떨까 합니다.
| proptest! { | ||
| #[test] | ||
| fn test_char_type_proptest(c: char) { | ||
| let result = CharType::new(c); | ||
| match result { | ||
| Ok(char_type) => { | ||
| match char_type { | ||
| CharType::Korean(korean_char) => { | ||
| assert!(korean_char.cho != '\0'); | ||
| assert!(korean_char.jung != '\0'); | ||
| } | ||
| CharType::KoreanPart(ch) => { | ||
| let code = ch as u32; | ||
| assert!(0x3131 <= code && code <= 0x3163); | ||
| } | ||
| CharType::English(ch) => { | ||
| assert!(ch.is_ascii_alphabetic()); | ||
| } | ||
| CharType::Number(ch) => { | ||
| assert!(ch.is_ascii_digit()); | ||
| } | ||
| CharType::Symbol(ch) => { | ||
| assert!(is_symbol_char(ch)); | ||
| } | ||
| CharType::MathSymbol(ch) => { | ||
| assert!(is_math_symbol_char(ch)); | ||
| } | ||
| CharType::Space(ch) => { | ||
| assert!(ch.is_whitespace()); | ||
| } | ||
| } | ||
| } | ||
| Err(_) => { | ||
|
|
||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
제가 잘 몰라서 그런데 proptest 와 같이 작성될 경우 무작위의 값이 들어가는 건가요?
There was a problem hiding this comment.
네 맞습니다. 임의의 값을 넣어서 여러 번 호출해 주기 때문에, 입력 범위에 대해 랜덤샘플링으로 테스트하는 효과를 냅니다
Codecov ReportAll modified and coverable lines are covered by tests ✅
🚀 New features to boost your workflow:
|
encode/decode가 둘다 있는줄 알고 roundtrip 테스트를 만들려고 했는데요.
나중에 decode가 붙으면 decode 까지 테스트할수 있게 남겨두었습니다