質問するログイン新規登録

回答編集履歴

1

.

2023/04/28 03:27

投稿

int32_t
int32_t

スコア22007

answer CHANGED
@@ -2,3 +2,10 @@
2
2
  [My code calls a static/global function. Can I mock it?](https://google.github.io/googletest/gmock_faq.html#my-code-calls-a-staticglobal-function-can-i-mock-it)
3
3
 
4
4
  大雑把に言うと「それはできないので、テスト対象コードを書き換える必要あり」です。
5
+
6
+ たとえば `MyClass` をパラメータ化するとか。
7
+ ```c++
8
+ template <typename T> bool init(const SubClass& subClass) {
9
+ ...
10
+ myclasptr = T::Create();
11
+ ```