Skip to content
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

[DRAFT] Fix #45: Add unittest (Google Test) #78

Merged
merged 2 commits into from Jun 9, 2019

Conversation

ma8ma
Copy link
Collaborator

@ma8ma ma8ma commented Jun 8, 2019

Unittest機能を追加しコードのチェックをする仕組みを追加します。
テストパッケージは暫定的にGoogle Test(googletest)を利用します。

Google Test を利用する理由

  • webの情報量が多い
  • 依存関係が複雑でない
  • 使い勝手が良くテストの記述や追加が楽にできる
  • JDim本体のソースツリーやビルドプロセスと分離できる

テスト追加後のビルド

通常の ./configure && make ではテストプログラムのビルドや実行は行われません。

テストの実行方法

  1. はじめにディストリのgoogletestパッケージのインストールか、
    またはgoogletestリポジトリのクローンを行ってソースコードを用意します。
  2. 次に./configureの引数 GTEST_SRCDIR にgoogletestのディレクトリを指定してビルドします。
    引数を指定しないとテストプログラムのビルドは失敗します。
  3. そしてテストプログラムのビルドと実行は make test で行います。

詳細はtest/README.mdをご覧ください。

/cc @henrich Pull Requestや手引きの内容にDebianのガイドと適合しない部分がありましたらお申し付けください。

ma8ma added 2 commits June 8, 2019 16:54
機能をテストするための仕組みを追加する。テストライブラリは暫定として
Google's C++ test framework(googletest)を使う。
googletestはJDimリポジトリには同梱せずディストリビューションの
ソースパッケージをインストールするかリポジトリをクローンして利用する。
テストのビルドや実行方法などの説明はtest/README.mdを参照。
NOTE: 拡張機能のGoogle Mockは利用していないので設定されていない。

テストライブラリの選考基準
* webの情報量が多いか
* 依存関係が複雑でないか
* 使い勝手が良くテストの記述や追加が楽にできるか
* JDim本体のソースツリーやビルドプロセスと分離できるか
Unittest機能を確認するためにコード例を追加する。
このコミットは実際のテストケースが追加されたときにrevertしてよい。
@ma8ma ma8ma added the test テストの変更 label Jun 8, 2019
@ma8ma ma8ma added this to In progress in State of JDim-v0.1.0+ via automation Jun 8, 2019
@yama-natuki yama-natuki marked this pull request as ready for review June 9, 2019 00:38
@yama-natuki yama-natuki merged commit 923ea66 into JDimproved:master Jun 9, 2019
State of JDim-v0.1.0+ automation moved this from In progress to Done Jun 9, 2019
@yama-natuki
Copy link
Collaborator

ありがとうございます。

@ma8ma ma8ma deleted the add-unittest branch June 9, 2019 07:38
@ma8ma ma8ma added the build ビルドに関するトピック label Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build ビルドに関するトピック test テストの変更
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants