Skip to content

Commit 6f13d75

Browse files
authored
Merge pull request #1051 from stweil/googletest
Add GoogleTest infrastructure
2 parents 3847b7d + 99755b0 commit 6f13d75

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,6 @@ kernel*.bin
8282
/*.exe
8383
/*.lnk
8484
/win*
85+
86+
# GoogleTest
87+
googletest

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "googletest"]
2+
path = googletest
3+
url = https://github.com/google/googletest.git

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,12 @@ target_link_libraries (tesseract libtesseract)
252252

253253
########################################
254254

255+
if (EXISTS ${PROJECT_SOURCE_DIR}/googletest/CMakeLists.txt)
256+
add_subdirectory(googletest)
257+
add_executable(tesseract_tests tests/tesseracttests.cpp)
258+
target_link_libraries(tesseract_tests gtest_main)
259+
endif()
260+
255261
if (BUILD_TRAINING_TOOLS)
256262
add_subdirectory(training)
257263
endif()

googletest

Submodule googletest added at 4bab34d

tests/tesseracttests.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
///////////////////////////////////////////////////////////////////////
2+
// File: tesseracttests.cpp
3+
// Description: Tests for Tesseract.
4+
// Author: Stefan Weil
5+
//
6+
// Licensed under the Apache License, Version 2.0 (the "License");
7+
// you may not use this file except in compliance with the License.
8+
// You may obtain a copy of the License at
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
// Unless required by applicable law or agreed to in writing, software
11+
// distributed under the License is distributed on an "AS IS" BASIS,
12+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
// See the License for the specific language governing permissions and
14+
// limitations under the License.
15+
///////////////////////////////////////////////////////////////////////
16+
17+
#include "gtest/gtest.h"
18+
19+
TEST(TesseractTest, FirstDummyTestForTesseract) {
20+
ASSERT_TRUE(1);
21+
}
22+
23+
int main(int argc, char **argv) {
24+
::testing::InitGoogleTest(&argc, argv);
25+
return RUN_ALL_TESTS();
26+
}

0 commit comments

Comments
 (0)