Skip to content

Commit

Permalink
upload projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Hunkar Ciplak committed Jul 4, 2020
1 parent dd5f955 commit 48da79c
Show file tree
Hide file tree
Showing 846 changed files with 359,879 additions and 1 deletion.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 1,26 @@
# googleTest-GTest-GMock-unit_test-
# googleTest-unit_test
- Example usages of GTest and GMock from googletest.
- Includes 3 mini-projects:
- test_hello
- test_fixture
- test_mock


## Requirements
- Ubuntu
- CMake (version > 3.15.2)

## Projects
- test_hello : How to start with GTest
- test_fixture: How to use fixture from GTest
- test_mock: How to use GMock from googletest with an example. APP_SOURCES is assumed the code under test, which is also using an interface to receive data. MOCK is the mocking of external interface on which the APP_SOURCES has dependency.

## Build & Run
- Build:
- Get in build directory of each mini-project and type "cmake .."
- In the build directory type "make"
- Run:
- ./test_hello for test_hello mini-project.
- ./test_fixture for test_fixture mini-project.
- ./test_mock for test_mock mini-project.

7 changes: 7 additions & 0 deletions test_fixture/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions test_fixture/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions test_fixture/.idea/test_fixture.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions test_fixture/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions test_fixture/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 1,13 @@
cmake_minimum_required(VERSION 3.15.2)

include_directories(${CMAKE_SOURCE_DIR}/googletest_R1100/googletest/googletest/include)
include_directories(${CMAKE_SOURCE_DIR}/googletest_R1100/googletest/googlemock/include)

add_subdirectory(googletest_R1100)

add_executable(test_fixture test_fixture.cpp)
target_link_libraries(test_fixture
gtest_main
gmock
gtest
pthread)
15 changes: 15 additions & 0 deletions test_fixture/googletest_R1100/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 1,15 @@
cmake_minimum_required(VERSION 2.8.2)

project(googletest-download NONE)

include(ExternalProject)
ExternalProject_Add(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG master
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
)
4 changes: 4 additions & 0 deletions test_fixture/googletest_R1100/googletest/.clang-format
Original file line number Diff line number Diff line change
@@ -0,0 1,4 @@
# Run manually to reformat a file:
# clang-format -i --style=file <file>
Language: Cpp
BasedOnStyle: Google
84 changes: 84 additions & 0 deletions test_fixture/googletest_R1100/googletest/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 1,84 @@
# Ignore CI build directory
build/
xcuserdata
cmake-build-debug/
.idea/
bazel-bin
bazel-genfiles
bazel-googletest
bazel-out
bazel-testlogs
# python
*.pyc

# Visual Studio files
.vs
*.sdf
*.opensdf
*.VC.opendb
*.suo
*.user
_ReSharper.Caches/
Win32-Debug/
Win32-Release/
x64-Debug/
x64-Release/

# Ignore autoconf / automake files
Makefile.in
aclocal.m4
configure
build-aux/
autom4te.cache/
googletest/m4/libtool.m4
googletest/m4/ltoptions.m4
googletest/m4/ltsugar.m4
googletest/m4/ltversion.m4
googletest/m4/lt~obsolete.m4
googlemock/m4

# Ignore generated directories.
googlemock/fused-src/
googletest/fused-src/

# macOS files
.DS_Store
googletest/.DS_Store
googletest/xcode/.DS_Store

# Ignore cmake generated directories and files.
CMakeFiles
CTestTestfile.cmake
Makefile
cmake_install.cmake
googlemock/CMakeFiles
googlemock/CTestTestfile.cmake
googlemock/Makefile
googlemock/cmake_install.cmake
googlemock/gtest
/bin
/googlemock/gmock.dir
/googlemock/gmock_main.dir
/googlemock/RUN_TESTS.vcxproj.filters
/googlemock/RUN_TESTS.vcxproj
/googlemock/INSTALL.vcxproj.filters
/googlemock/INSTALL.vcxproj
/googlemock/gmock_main.vcxproj.filters
/googlemock/gmock_main.vcxproj
/googlemock/gmock.vcxproj.filters
/googlemock/gmock.vcxproj
/googlemock/gmock.sln
/googlemock/ALL_BUILD.vcxproj.filters
/googlemock/ALL_BUILD.vcxproj
/lib
/Win32
/ZERO_CHECK.vcxproj.filters
/ZERO_CHECK.vcxproj
/RUN_TESTS.vcxproj.filters
/RUN_TESTS.vcxproj
/INSTALL.vcxproj.filters
/INSTALL.vcxproj
/googletest-distribution.sln
/CMakeCache.txt
/ALL_BUILD.vcxproj.filters
/ALL_BUILD.vcxproj
73 changes: 73 additions & 0 deletions test_fixture/googletest_R1100/googletest/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 1,73 @@
# Build matrix / environment variable are explained on:
# https://docs.travis-ci.com/user/customizing-the-build/
# This file can be validated on:
# http://lint.travis-ci.org/

language: cpp

# Define the matrix explicitly, manually expanding the combinations of (os, compiler, env).
# It is more tedious, but grants us far more flexibility.
matrix:
include:
- os: linux
before_install: chmod -R x ./ci/*platformio.sh
install: ./ci/install-platformio.sh
script: ./ci/build-platformio.sh
- os: linux
dist: xenial
compiler: gcc
install: ./ci/install-linux.sh && ./ci/log-config.sh
script: ./ci/build-linux-bazel.sh
- os: linux
dist: xenial
compiler: clang
install: ./ci/install-linux.sh && ./ci/log-config.sh
script: ./ci/build-linux-bazel.sh
- os: linux
compiler: gcc
env: BUILD_TYPE=Debug VERBOSE=1 CXX_FLAGS=-std=c 11
- os: linux
compiler: clang
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c 11 -Wgnu-zero-variadic-macro-arguments
- os: linux
compiler: clang
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c 11 NO_EXCEPTION=ON NO_RTTI=ON COMPILER_IS_GNUCXX=ON
- os: osx
compiler: gcc
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c 11 HOMEBREW_LOGS=~/homebrew-logs HOMEBREW_TEMP=~/homebrew-temp
- os: osx
compiler: clang
env: BUILD_TYPE=Release VERBOSE=1 CXX_FLAGS=-std=c 11 HOMEBREW_LOGS=~/homebrew-logs HOMEBREW_TEMP=~/homebrew-temp

# These are the install and build (script) phases for the most common entries in the matrix. They could be included
# in each entry in the matrix, but that is just repetitive.
install:
- ./ci/install-${TRAVIS_OS_NAME}.sh
- . ./ci/env-${TRAVIS_OS_NAME}.sh
- ./ci/log-config.sh

script: ./ci/travis.sh

# This section installs the necessary dependencies.
addons:
apt:
# List of whitelisted in travis packages for ubuntu-precise can be found here:
# https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
# List of whitelisted in travis apt-sources:
# https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.9
packages:
- g -4.9
- clang-3.9
update: true
homebrew:
packages:
- ccache
- [email protected]
- llvm@4
update: true

notifications:
email: false
Loading

0 comments on commit 48da79c

Please sign in to comment.