Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
45c58aa6
Commit
45c58aa6
authored
Jan 07, 2019
by
Chris
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: Add Arduino setup()/loop() functions back
Added setup()/loop() functions back to *_main.cc files to support compiling in CI. Future features could enable this for the end user.
parent
23e69378
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
0 deletions
+28
-0
gmock_main.cc
googlemock/src/gmock_main.cc
+14
-0
gtest_main.cc
googletest/src/gtest_main.cc
+14
-0
No files found.
googlemock/src/gmock_main.cc
View file @
45c58aa6
...
@@ -32,6 +32,18 @@
...
@@ -32,6 +32,18 @@
#include "gmock/gmock.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#ifdef ARDUINO
void
setup
()
{
int
argc
=
0
;
char
**
argv
=
nullptr
;
// Since Google Mock depends on Google Test, InitGoogleMock() is
// also responsible for initializing Google Test. Therefore there's
// no need for calling testing::InitGoogleTest() separately.
testing
::
InitGoogleMock
(
&
argc
,
argv
);
}
void
loop
()
{
RUN_ALL_TESTS
();
}
#else
// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
// MS C++ compiler/linker has a bug on Windows (not on Windows CE), which
// causes a link error when _tmain is defined in a static library and UNICODE
// causes a link error when _tmain is defined in a static library and UNICODE
// is enabled. For this reason instead of _tmain, main function is used on
// is enabled. For this reason instead of _tmain, main function is used on
...
@@ -52,3 +64,5 @@ GTEST_API_ int main(int argc, char** argv) {
...
@@ -52,3 +64,5 @@ GTEST_API_ int main(int argc, char** argv) {
testing
::
InitGoogleMock
(
&
argc
,
argv
);
testing
::
InitGoogleMock
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
return
RUN_ALL_TESTS
();
}
}
#endif
googletest/src/gtest_main.cc
View file @
45c58aa6
...
@@ -30,8 +30,22 @@
...
@@ -30,8 +30,22 @@
#include <stdio.h>
#include <stdio.h>
#include "gtest/gtest.h"
#include "gtest/gtest.h"
#ifdef ARDUINO
void
setup
()
{
int
argc
=
0
;
char
**
argv
=
nullptr
;
testing
::
InitGoogleTest
(
&
argc
,
argv
);
}
void
loop
()
{
RUN_ALL_TESTS
();
}
#else
GTEST_API_
int
main
(
int
argc
,
char
**
argv
)
{
GTEST_API_
int
main
(
int
argc
,
char
**
argv
)
{
printf
(
"Running main() from %s
\n
"
,
__FILE__
);
printf
(
"Running main() from %s
\n
"
,
__FILE__
);
testing
::
InitGoogleTest
(
&
argc
,
argv
);
testing
::
InitGoogleTest
(
&
argc
,
argv
);
return
RUN_ALL_TESTS
();
return
RUN_ALL_TESTS
();
}
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment