Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Jul 7, 2024. It is now read-only.

Commit 9102d6c

Browse files
committed
add a minor test for parsing ContestQuestionNode
1 parent 98885a0 commit 9102d6c

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

‎tests/de.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
use leetcode_cli::cache::models::VerifyResult;
1+
2+
// TODO: add a lot more tests
3+
use leetcode_cli::cache::models::{
4+
VerifyResult, ContestQuestionStub, Contest
5+
};
26
use serde_json;
7+
use serde_json::Error as SerdeError;
8+
type SerdeResult<T> = Result<T, SerdeError>;
39

410
#[test]
511
fn de_from_test_success() {
@@ -80,3 +86,17 @@ fn de_unknown_error() {
8086
);
8187
assert!(r.is_ok());
8288
}
89+
90+
#[test]
91+
fn de_from_contest_question_stub() {
92+
let r: SerdeResult<ContestQuestionStub> =
93+
serde_json::from_str(r#"{
94+
"id": 2701,
95+
"question_id": 2368,
96+
"credit": 6,
97+
"title": "Sum of Total Strength of Wizards",
98+
"title_slug": "sum-of-total-strength-of-wizards"
99+
}"#);
100+
assert!(r.is_ok());
101+
}
102+

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /