diff options
author | aqua <aqua@iserlohn-fortress.net> | 2024-08-18 15:08:13 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2024-08-18 15:08:13 +0300 |
commit | ff0286195eeb4dc659863af4afbdf9ddd4d53a1b (patch) | |
tree | 94b06a2efdf8b349f7822dd79f5a6de5780bcbe3 /tools/interface_generator/templates | |
parent | Moved pytest to private (diff) | |
download | kernel-ff0286195eeb4dc659863af4afbdf9ddd4d53a1b.tar.xz |
Moved interface_generator script to bin
Diffstat (limited to 'tools/interface_generator/templates')
7 files changed, 0 insertions, 85 deletions
diff --git a/tools/interface_generator/templates/__c_functions.mako b/tools/interface_generator/templates/__c_functions.mako deleted file mode 100644 index 2e40119..0000000 --- a/tools/interface_generator/templates/__c_functions.mako +++ /dev/null @@ -1,4 +0,0 @@ -/* Functions */ -% for fn in functions: -${fn['return']} ${name}_${fn['name']}(${ ", ".join(fn['arguments']) }); -% endfor diff --git a/tools/interface_generator/templates/__c_system_include.mako b/tools/interface_generator/templates/__c_system_include.mako deleted file mode 100644 index d6a9d09..0000000 --- a/tools/interface_generator/templates/__c_system_include.mako +++ /dev/null @@ -1,4 +0,0 @@ -/* System includes */ -% for path in system_includes: -#include <${path}> -% endfor diff --git a/tools/interface_generator/templates/__c_types.mako b/tools/interface_generator/templates/__c_types.mako deleted file mode 100644 index ce6b6b5..0000000 --- a/tools/interface_generator/templates/__c_types.mako +++ /dev/null @@ -1,6 +0,0 @@ -/* Types */ -% for type in types: -typedef struct ${name}_${type['name']} { -${ "\n".join([ " {};".format(member) for member in type['members'] ]) } -} ${name}_${type['name']}; -% endfor diff --git a/tools/interface_generator/templates/__header.mako b/tools/interface_generator/templates/__header.mako deleted file mode 100644 index 24b0381..0000000 --- a/tools/interface_generator/templates/__header.mako +++ /dev/null @@ -1,5 +0,0 @@ -/* This file is generated by ${PROG['name']} v${PROG['version']} */ - -/****************************************************************************** -${ license } - ******************************************************************************/ diff --git a/tools/interface_generator/templates/interface.h.mako b/tools/interface_generator/templates/interface.h.mako deleted file mode 100644 index 47ea940..0000000 --- a/tools/interface_generator/templates/interface.h.mako +++ /dev/null @@ -1,8 +0,0 @@ -<%include file="__header.mako" /> -#ifndef ${ name.upper() } -#define ${ name.upper() } - -<%include file="__c_system_include.mako" /> -<%include file="__c_types.mako" /> -<%include file="__c_functions.mako" /> -#endif /* ${ name.upper() } */ diff --git a/tools/interface_generator/templates/interface_mock.cpp.mako b/tools/interface_generator/templates/interface_mock.cpp.mako deleted file mode 100644 index 721f2c4..0000000 --- a/tools/interface_generator/templates/interface_mock.cpp.mako +++ /dev/null @@ -1,32 +0,0 @@ -<%include file="__header.mako" /> - -#include <stdexcept> -#include "${name}_mock.hpp" - -static I${name}_mock *s_instance = nullptr; - -I${name}_mock::I${name}_mock() -{ - if(s_instance != nullptr) - { - throw std::runtime_error("Creating a second instance of mock object"); - } - s_instance = this; -} - -I${name}_mock::~I${name}_mock() -{ - // destructors shouldn't throw exceptions - s_instance = nullptr; -} - -% for fn in functions: -${fn['return']} ${name}_${fn['name']}(${ ", ".join(fn['arguments']) }) -{ - if(s_instance == nullptr) - { - throw std::runtime_error("No mock created to handle function ${name}_${fn['name']}"); - } - return s_instance->${fn['name']}(${ ", ".join(fn['argument_names']) }); -} -% endfor diff --git a/tools/interface_generator/templates/interface_mock.hpp.mako b/tools/interface_generator/templates/interface_mock.hpp.mako deleted file mode 100644 index e33d50e..0000000 --- a/tools/interface_generator/templates/interface_mock.hpp.mako +++ /dev/null @@ -1,26 +0,0 @@ -<%include file="__header.mako" /> -#ifndef ${ name.upper() }_MOCK -#define ${ name.upper() }_MOCK - -extern "C" { -#include "${ name }.h" -} - -#include <gtest/gtest.h> -#include <gmock/gmock.h> - -class I${name}_mock -{ -public: - I${name}_mock(); - ~I${name}_mock(); - - /* Functions */ -% for fn in functions: - MOCK_METHOD(${fn['return']}, ${fn['name']}, (${ ", ".join(fn['arguments']) })); -% endfor -}; - -using ${name}_mock = ::testing::NiceMock<I${name}_mock>; - -#endif /* ${ name.upper() }_MOCK */ |