-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[test] http_parseクラスをテストする関数を修正 #194
The head ref may contain hidden characters: "187-test-http_parse\u306E\u30C6\u30B9\u30C8\u95A2\u6570\u3092\u4FEE\u6B63"
Conversation
Walkthrough今回の変更では、新たにHTTPパースのユニットテスト用ディレクトリが作成され、関連するテストがMakefileに追加されました。これによりテスト対象が拡張され、HTTPメッセージの処理に関するファイルが統合されたほか、エラーハンドリングの改善が図られました。全体として、テストフレームワークの効率性と信頼性が向上しました。 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TestSuite
participant HttpParser
User->>TestSuite: テストを開始
TestSuite->>HttpParser: リクエストを解析
HttpParser-->>TestSuite: 結果を返す
TestSuite-->>User: テスト結果を出力
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
HandleResult: resultによってOK, KO出力し、成功か失敗を出力する関数 - KOの場合はerror_logを出力
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- test/unit/Makefile (1 hunks)
- test/unit/http_parse/Makefile (1 hunks)
- test/unit/http_parse/test_http_parse.cpp (3 hunks)
Files skipped from review due to trivial changes (1)
- test/unit/Makefile
Additional comments not posted (16)
test/unit/http_parse/Makefile (7)
1-9
: 設定は問題ありません。ディレクトリ名とログファイルパスの設定は標準的です。
10-15
: 設定は問題ありません。ターゲットのwebservファイルを追加する設定は標準的です。
16-22
: 設定は問題ありません。ソースファイルを追加する設定は標準的です。
24-27
: 設定は問題ありません。インクルードディレクトリを追加する設定は標準的です。
29-51
: 設定は問題ありません。オブジェクトファイルとコンパイルルールの設定は標準的です。
52-61
: 設定は問題ありません。クリーンとリビルドのルールの設定は標準的です。
63-80
: 設定は問題ありません。テストの実行とログの処理のルールの設定は標準的です。
test/unit/http_parse/test_http_parse.cpp (9)
20-24
: 構造体Result
は問題ありません。この構造体は比較結果とエラーログをカプセル化しており、エラーハンドリングを強化しています。
26-30
: 関数GetTestCaseNum
は問題ありません。この関数は静的なテストケース番号を返します。
32-50
: 関数IsSameRequestLine
は問題ありません。この関数はリクエストラインを比較し、
Result
構造体を返します。エラーレポートを強化しています。
53-69
: 関数IsSameHeaderFields
は問題ありません。この関数はヘッダーフィールドを比較し、
Result
構造体を返します。エラーレポートを強化しています。
71-80
: 関数IsSameHttpRequest
は問題ありません。この関数はHTTPリクエストを比較し、
Result
構造体を返します。エラーレポートを強化しています。
82-93
: 関数IsSameStatusCode
は問題ありません。この関数はステータスコードを比較し、
Result
構造体を返します。エラーレポートを強化しています。
96-108
: 関数HandleResult
は問題ありません。この関数はテストの結果を処理し、適切なメッセージを出力します。エラーレポートを強化しています。
116-124
: 関数Run
は問題ありません。この関数はテストケースを実行し、結果を処理します。エラーレポートを強化しています。
126-138
: 関数RunTestCases
とmain
は問題ありません。これらの関数は複数のテストケースを実行し、メイン関数はテストを初期化して実行します。エラーレポートを強化しています。
Also applies to: 139-196
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- test/unit/http_parse/test_http_parse.cpp (3 hunks)
Additional comments not posted (4)
test/unit/http_parse/test_http_parse.cpp (4)
20-24
: LGTM!
Result
構造体は適切に実装されています。
71-80
: LGTM!
IsSameHttpRequest
関数は適切に実装されています。
82-93
: LGTM!
IsSameStatusCode
関数は適切に実装されています。
116-124
: LGTM!
Run
関数は適切に実装されています。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- test/unit/http_parse/test_http_parse.cpp (3 hunks)
Additional comments not posted (7)
test/unit/http_parse/test_http_parse.cpp (7)
20-24
: LGTM!
Result
構造体は、比較結果とエラーログをカプセル化するために使用されており、その目的を十分に果たしています。
26-30
: LGTM!
GetTestCaseNum
関数は、一意のテストケース番号を返すシンプルな実装です。
70-79
: LGTM!
IsSameHttpRequest
関数は、IsSameRequestLine
およびIsSameHeaderFields
関数を呼び出して結果を集約し、Result
構造体を返す正しい実装です。
93-108
: LGTM!
HandleResult
関数は、Result
構造体を処理し、適切な成功または失敗メッセージを出力する正しい実装です。
116-124
: LGTM!
Run
関数は、テストケースを実行し、HandleResult
を使用して結果を処理する正しい実装です。
126-134
: LGTM!
RunTestCases
関数は、すべてのテストケースを実行し、その結果を集約する正しい実装です。
Line range hint
139-175
:
LGTM!
main
関数は、テストケースを初期化し、RunTestCases
を呼び出す正しい実装です。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Outside diff range, codebase verification and nitpick comments (1)
test/unit/http_parse/test_http_parse.cpp (1)
Line range hint
139-195
:
変数名の一貫性を改善してください。変数名が一貫していないため、読みやすさを向上させるために以下のように改善できます。
- http::HttpRequestResult expected_header_fileds_test_4; + http::HttpRequestResult expected_header_fields_test_4; - http::HttpRequestResult expected_header_fileds_test_5; + http::HttpRequestResult expected_header_fields_test_5; - http::HttpRequestResult expected_header_fileds_test_6; + http::HttpRequestResult expected_header_fields_test_6; - http::HttpRequestResult expected_header_fileds_test_7; + http::HttpRequestResult expected_header_fields_test_7;
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- test/unit/http_parse/test_http_parse.cpp (3 hunks)
Additional comments not posted (6)
test/unit/http_parse/test_http_parse.cpp (6)
20-24
: LGTM!
Result
構造体の導入により、比較結果とエラーログをカプセル化することができ、エラーハンドリングとレポートが改善されています。
26-30
: LGTM!
GetTestCaseNum
関数は静的なテストケース番号をインクリメントして返すシンプルな実装です。
70-79
: LGTM!
IsSameHttpRequest
関数は、HTTPリクエストを比較し、エラーをログに記録する正しい実装です。
93-108
: LGTM!
HandleResult
関数は、結果を処理し、成功または失敗のメッセージを出力する正しい実装です。
116-124
: LGTM!
Run
関数は、テストケースを実行し、結果を処理する正しい実装です。
126-134
: LGTM!
RunTestCases
関数は、テストケースを反復処理し、それらを実行する正しい実装です。
5a4dbc3
to
2a42b0b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- test/unit/http_parse/test_http_parse.cpp (3 hunks)
Additional comments not posted (7)
test/unit/http_parse/test_http_parse.cpp (7)
20-24
: LGTM!
Result
構造体はシンプルで正しく初期化されています。
26-30
: LGTM!
GetTestCaseNum
関数はシンプルで正しく実装されています。
71-80
: LGTM!
IsSameHttpRequest
関数は正しく比較を委任し、適切な結果を返しています。
94-109
: LGTM!
HandleResult
関数は結果を正しく処理し、適切なメッセージを出力しています。
117-125
: LGTM!
Run
関数はテストケースを正しく実行し、HandleResult
を使用して結果を処理しています。
127-135
: LGTM!
RunTestCases
関数はテストケースを正しく反復し、実行しています。
Line range hint
140-179
:
LGTM!
main
関数はテストケースを正しく設定し、実行しています。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ありがとうございます!
実行確認もしました、良い感じだと思います
細かい気になったとこだけコメントしました
ちなみに return ( )
はもう言うのやめます…笑
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 6
Outside diff range, codebase verification and nitpick comments (1)
test/unit/http_parse/test_http_parse.cpp (1)
20-23
: 初期化リストを使用してください
Result
構造体のコンストラクタで初期化リストを使用すると、コードの可読性が向上します。- Result() : is_success(true) {} + Result() : is_success(true), error_log("") {}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
メッセージが見やすくなりましたありがとう。
したこと
してないこと
-> 理由: [http] リクエストの情報をHttpParseに送るかどうかを判定をどうするか?調査 #192 の結果、 httpクラスの引数は全体を読み込んだリクエスト情報ではなく、一回のリクエスト情報とするため読み込んだ値を入れて各書式が完全ではない場合は、まだ完全でないよ!っていう情報をserverに送るため。もしserverに送った結果クライアントから情報を送られてこない場合はserver側が待機中になり、ある一定の時間が過ぎればserverはhttpクラスに408 Request Timeoutレスポンスを作成するのを要求するので一旦相談してから必要があれば作成する。
今後
-> チームのメンバー壁打ちしてもらう
Summary by CodeRabbit
新機能
バグ修正