katono / pcunit Goto Github PK
View Code? Open in Web Editor NEWPortable C Unit Testing Framework
Portable C Unit Testing Framework
https://github.com/katono/PCUnit/issues/3にて、mockのexpect()とset_callback()を両方有効化可能とした件に関連して問題が発生しています。
結論としてはmockのexpect()とset_callback()を両方有効化した場合、mockの戻り値はexpect()側を優先した方が良いと思われます。弊方でもPullRequestの準備をしておりますが、仕様として問題がないか回答をお願い致します。
http://d.hatena.ne.jp/katono123/20150313/1426172490で紹介されている「C標準関数やシステムコールのモック化」を実践した場合において「test_Hoge_new_fail()」の試験ができなくなってしまっています。
mockの戻り値はコールバックが優先されるため、上記テストではorginalのmalloc()の戻り値が常に返却されます。
mock機能に関して仕様の相談があります。
mock関数にアドレスを渡して、そのアドレスに特定の値をセットするケースでset_callback()を用いますが、引数値のチェックはexpect()を利用したいケースが多々あります。しかし、現状の実装はexpect()とset_callback()の両方をテストケース内で呼び出した場合、expect()を優先する仕様となっています。(callback関数の登録は無視)
以上の要求を満たすべく、expect()とset_callback()の両方を実行した場合、以下動作とする修正を加えたいと考えています。
以下にコミットしております。仕様に問題がなければ、本ブランチにてpull requestを出したいと思っています。
以下にコミットしております。本サンプルはpull requestの対象外とする予定です。
以上、お手数ですが確認をよろしくお願いいたします。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.