Skip to content

update googletest. #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
May 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -18,7 +18,6 @@ build/bin/Debug/cppcore.dll
*.check_cache
*.rule
build/CMakeFiles/2.8.12.2/CompilerIdC/CMakeCCompilerId.c
*.cmake
*.bin
build/CMakeFiles/TargetDirectories.txt
build/CMakeFiles/generate.stamp.list
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -30,8 +30,5 @@ matrix:
compiler: gcc
env: ANALYZE=ON

before_script:
- cd build && cmake -G "Unix Makefiles" && cd ..

script:
- . ./.travis.sh
117 changes: 54 additions & 63 deletions build/CMakeLists.txt → CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -29,13 +29,13 @@ add_definitions( -D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING=1)

INCLUDE_DIRECTORIES( BEFORE
${CMAKE_HOME_DIRECTORY}/..
${CMAKE_HOME_DIRECTORY}/../include/
${CMAKE_HOME_DIRECTORY}/../contrib/gtest-1.7.0/include
${CMAKE_HOME_DIRECTORY}/../contrib/gtest-1.7.0/
${CMAKE_HOME_DIRECTORY}/include/
${CMAKE_HOME_DIRECTORY}/contrib/googletest-1.10.0/gtest/include
${CMAKE_HOME_DIRECTORY}/contrib/googletest-1.10.0/gtest
)

link_directories(
${CMAKE_HOME_DIRECTORY}/../
${CMAKE_HOME_DIRECTORY}/
)

SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib )
@@ -69,40 +69,40 @@ IF (ASSIMP_UBSAN)
ENDIF()

SET ( cppcore_src
../code/cppcore.cpp
../include/cppcore/CPPCoreCommon.h
code/cppcore.cpp
include/cppcore/CPPCoreCommon.h
)

SET ( cppcore_common_src
../include/cppcore/Common/Hash.h
../include/cppcore/Common/TStringBase.h
../include/cppcore/Common/TSharedPtr.h
../include/cppcore/Common/Variant.h
include/cppcore/Common/Hash.h
include/cppcore/Common/TStringBase.h
include/cppcore/Common/TSharedPtr.h
include/cppcore/Common/Variant.h
)

SET( cppcore_random_src
../include/cppcore/Random/RandomGenerator.h
../code/Random/RandomGenerator.cpp
include/cppcore/Random/RandomGenerator.h
code/Random/RandomGenerator.cpp
)

SET ( cppcore_container_src
../include/cppcore/Container/THashMap.h
../include/cppcore/Container/TArray.h
../include/cppcore/Container/TStaticArray.h
../include/cppcore/Container/TList.h
../include/cppcore/Container/TQueue.h
../include/cppcore/Container/TStaticArray.h
include/cppcore/Container/THashMap.h
include/cppcore/Container/TArray.h
include/cppcore/Container/TStaticArray.h
include/cppcore/Container/TList.h
include/cppcore/Container/TQueue.h
include/cppcore/Container/TStaticArray.h
)

SET ( cppcore_memory_src
../include/cppcore/Memory/MemUtils.h
../include/cppcore/Memory/TStackAllocator.h
../include/cppcore/Memory/TPoolAllocator.h
../code/Memory/MemUtils.cpp
include/cppcore/Memory/MemUtils.h
include/cppcore/Memory/TStackAllocator.h
include/cppcore/Memory/TPoolAllocator.h
code/Memory/MemUtils.cpp
)

SET( cppcore_io_src
../include/cppcore/IO/FileSystem.h
include/cppcore/IO/FileSystem.h
)

SOURCE_GROUP( code FILES ${cppcore_src} )
@@ -116,74 +116,65 @@ ADD_LIBRARY( cppcore SHARED
${cppcore_container_src}
${cppcore_common_src}
${cppcore_memory_src}
${cppcore_random_src}
${cppcore_random_src}
${cppcore_io_src}
${cppcore_src}
README.md
)


IF( BUILD_UNITTESTS )
SET( cppcore_test_src
../test/CPPCoreCommonTest.cpp
test/CPPCoreCommonTest.cpp
)

SET( cppcore_common_test_src
../test/common/HashTest.cpp
../test/common/VariantTest.cpp
../test/common/TSharedPtrTest.cpp
test/common/HashTest.cpp
test/common/VariantTest.cpp
test/common/TSharedPtrTest.cpp
)

SET( cppcore_container_test_src
../test/container/TArrayTest.cpp
../test/container/THashMapTest.cpp
../test/container/TListTest.cpp
../test/container/TQueueTest.cpp
../test/container/TStaticArrayTest.cpp
test/container/TArrayTest.cpp
test/container/THashMapTest.cpp
test/container/TListTest.cpp
test/container/TQueueTest.cpp
test/container/TStaticArrayTest.cpp
)

SET( cppcore_memory_test_src
../test/memory/TStackAllocatorTest.cpp
../test/memory/TPoolAllocatorTest.cpp
test/memory/TStackAllocatorTest.cpp
test/memory/TPoolAllocatorTest.cpp
)

SET( cppcore_random_test_src
../test/Random/RandomGeneratorTest.cpp
)

SET ( GTEST_PATH ../contrib/gtest-1.7.0 )

SET ( gtest_src
${GTEST_PATH}/src/gtest-death-test.cc
${GTEST_PATH}/src/gtest-filepath.cc
${GTEST_PATH}/src/gtest-internal-inl.h
${GTEST_PATH}/src/gtest-port.cc
${GTEST_PATH}/src/gtest-printers.cc
${GTEST_PATH}/src/gtest-test-part.cc
${GTEST_PATH}/src/gtest-typed-test.cc
${GTEST_PATH}/src/gtest.cc
${GTEST_PATH}/src/gtest_main.cc
SET( cppcore_random_test_src
test/Random/RandomGeneratorTest.cpp
)

SET ( GTEST_PATH ../contrib/googletest-1.10.0 )

SOURCE_GROUP( code FILES ${cppcore_test_src} )
SOURCE_GROUP( code\\common FILES ${cppcore_common_test_src} )
SOURCE_GROUP( code\\container FILES ${cppcore_container_test_src} )
SOURCE_GROUP( code\\memory FILES ${cppcore_memory_test_src} )
SOURCE_GROUP( code\\random FILES ${cppcore_random_test_src} )
SOURCE_GROUP( contrib\\gtest FILES ${gtest_src} )
SOURCE_GROUP( code\\random FILES ${cppcore_random_test_src} )

# Prevent overriding the parent project's compiler/linker
# settings on Windows
SET(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
ADD_SUBDIRECTORY( contrib/googletest-1.10.x/googletest )
ADD_EXECUTABLE( cppcore_unittest
${gtest_src}
${cppcore_test_src}
${cppcore_common_test_src}
${cppcore_memory_test_src}
${cppcore_random_test_src}
${cppcore_random_test_src}
${cppcore_container_test_src}
)

IF( WIN32 )
SET( platform_libs )
ELSE( WIN32 )
SET( platform_libs pthread )
ENDIF( WIN32 )
target_link_libraries( cppcore_unittest cppcore ${CMAKE_THREAD_LIBS_INIT} ${platform_libs} )


IF( WIN32 )
SET( platform_libs )
ELSE( WIN32 )
SET( platform_libs pthread )
ENDIF( WIN32 )
target_link_libraries( cppcore_unittest cppcore ${CMAKE_THREAD_LIBS_INIT} gtest_main ${platform_libs} )
ENDIF( BUILD_UNITTESTS )
62 changes: 31 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -5,9 +5,9 @@ for myself or libraries I worked on.
Feel free to use them or to show me, what I did wrong. I am also deploying my unit
tests, so doing a proof of my failures are easy :-).

Documentation:
--------------
https://readthedocs.org/projects/cppcore/ ( under construction )
Documentation
-------------
[Documentation - work in progress](https://readthedocs.org/projects/cppcore/)

How to build it:
----------------
@@ -27,39 +27,39 @@ If you are using Linux, you can build it with the make-command:

The library is pretty small and contains at this moment:

How to contribute
-----------------
See [How to contribute](CONTRIBUTING.md)

Common stuff:
-------------
- **Variant**: Implements a variant to deal with arbitrary data types.
- **THash**: A hash function to calculate hash values.
Common stuff
------------
* **Variant**: Implements a variant to deal with arbitrary data types.
* **THash**: A hash function to calculate hash values.

Containers:
Containers
----------
- **TStaticArray**: A static template-based array.
- **TArray**: A simple dynamic template-based array list, similar to std::vector. [Examples can be found here](https://github.com/kimkulling/cppcore/blob/master/test/container/TArrayTest.cpp)
- **TList**: A double template-based linked list. [Examples can be found here](https://github.com/kimkulling/cppcore/blob/master/test/container/TListTest.cpp)
- **TQueue**: A simple template-based FIFO queue.
- **THashMap**: A key-value template-based hash map for easy lookup tables
* **TStaticArray**: A static template-based array.
* **TArray**: A simple dynamic template-based array list, similar to std::vector. [Examples can be found here](https://github.com/kimkulling/cppcore/blob/master/test/container/TArrayTest.cpp)
* **TList**: A double template-based linked list. [Examples can be found here](https://github.com/kimkulling/cppcore/blob/master/test/container/TListTest.cpp)
* **TQueue**: A simple template-based FIFO queue.
* **THashMap**: A key-value template-based hash map for easy lookup tables

Memory:
-------
- **TStackAllocator**: A stack-based allocator, first allocation must be released at last ( FiFo-schema ).
- **TPoolAllocator**: A pool-based allocator. Not much overhead and really fast. At the moment it is not supported to release single objects.
Memory
------
* **TStackAllocator**: A stack-based allocator, first allocation must be released at last ( FiFo-schema ).
* **TPoolAllocator**: A pool-based allocator. Not much overhead and really fast. At the moment it is not supported to release single objects.

IO:
---
- **FileSystem**: Common file-system abstractions for platform independent access and info.
IO-Filesystem
-------------
* **FileSystem**: Common file-system abstractions for platform independent access and info.

Random:
-------
- **RandomGenerator**: A wrapper class to get random numbers. Currently supported are
+ The standard c++ random generator, be careful if you want to reach a good distribution of
your random values
+ The Mersenne-Twister randome generator which provides a much better distribution of points
Random
------
* **RandomGenerator**: A wrapper class to get random numbers. Currently supported are
* The standard c++ random generator, be careful if you want to reach a good distribution of
your random values
* The Mersenne-Twister randome generator which provides a much better distribution of points

Used in...
----------
- OSRE ( aka Open-Source-Render-Experience ): https://github.com/kimkulling/osre
* OSRE ( aka Open-Source-Render-Experience ): https://github.com/kimkulling/osre

How to contribute
-----------------
See [How to contribute](CONTRIBUTING.md)
12 changes: 0 additions & 12 deletions build/ClangOverrides.txt

This file was deleted.

6 changes: 4 additions & 2 deletions code/Random/RandomGenerator.cpp
Original file line number Diff line number Diff line change
@@ -53,8 +53,10 @@ static void mersenne_twister_vector_update(unsigned int* const p) {
}

unsigned int mersenne_twister() {
static unsigned int vector[ N ]; /* Zustandsvektor */
static int idx = N + 1; /* Auslese-Index; idx>N: neuer Vektor mu� berechnet werden, idx=N+1: Vektor mu� �berhaupt erst mal initialisiert werden */
// State-vector
static unsigned int vector[ N ];
// readout index
static int idx = N + 1;

if (static_cast<unsigned int>(idx) >= N) {
if (static_cast<unsigned int>(idx) > N) {
4 changes: 4 additions & 0 deletions contrib/googletest-1.10.x/.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 contrib/googletest-1.10.x/.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
Loading