From a2d4d14bd4f1a282e8a579441d9b39d6da64d71c Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 9 May 2017 16:56:10 +0200 Subject: [PATCH] mock_api: Only mock methods with less than 10 arguments GoogleMock only handles up to 10 arguments, but functions this big probably won't be used in mocked tests so we can just skip them. --- generator/templates/mock_api.cpp | 4 ++-- generator/templates/mock_api.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/generator/templates/mock_api.cpp b/generator/templates/mock_api.cpp index df1bd3eb4f..c2fd0696e9 100644 --- a/generator/templates/mock_api.cpp +++ b/generator/templates/mock_api.cpp @@ -16,7 +16,7 @@ namespace { {% for type in by_category["object"] %} - {% for method in native_methods(type) %} + {% for method in native_methods(type) if len(method.arguments) < 10 %} {{as_cType(method.return_type.name)}} Forward{{as_MethodSuffix(type.name, method.name)}}( {{-as_cType(type.name)}} self {%- for arg in method.arguments -%} @@ -45,7 +45,7 @@ void ProcTableAsClass::GetProcTableAndDevice(nxtProcTable* table, nxtDevice* dev *device = GetNewDevice(); {% for type in by_category["object"] %} - {% for method in native_methods(type) %} + {% for method in native_methods(type) if len(method.arguments) < 10 %} table->{{as_varName(type.name, method.name)}} = reinterpret_cast<{{as_cProc(type.name, method.name)}}>(Forward{{as_MethodSuffix(type.name, method.name)}}); {% endfor %} {% endfor %} diff --git a/generator/templates/mock_api.h b/generator/templates/mock_api.h index 79e66bd831..feaaf8f401 100644 --- a/generator/templates/mock_api.h +++ b/generator/templates/mock_api.h @@ -29,7 +29,7 @@ class ProcTableAsClass { {% endfor %} {% for type in by_category["object"] %} - {% for method in native_methods(type) %} + {% for method in native_methods(type) if len(method.arguments) < 10 %} virtual {{as_cType(method.return_type.name)}} {{as_MethodSuffix(type.name, method.name)}}( {{-as_cType(type.name)}} {{as_varName(type.name)}} {%- for arg in method.arguments -%} @@ -47,7 +47,7 @@ class ProcTableAsClass { class MockProcTable : public ProcTableAsClass { public: {% for type in by_category["object"] %} - {% for method in native_methods(type) %} + {% for method in native_methods(type) if len(method.arguments) < 10 %} MOCK_METHOD{{len(method.arguments) + 1}}( {{-as_MethodSuffix(type.name, method.name)}}, {{as_cType(method.return_type.name)}}(