megamove
This commit is contained in:
parent
c2e201f813
commit
f51105bde0
114 changed files with 92 additions and 0 deletions
3
tests/auto/auto.pro
Normal file
3
tests/auto/auto.pro
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += mycase
|
||||
29
tests/auto/gtest_dependency.pri
Normal file
29
tests/auto/gtest_dependency.pri
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
isEmpty(GOOGLETEST_DIR):GOOGLETEST_DIR=$$(GOOGLETEST_DIR)
|
||||
|
||||
isEmpty(GOOGLETEST_DIR) {
|
||||
warning("Using googletest src dir specified at Qt Creator wizard")
|
||||
message("set GOOGLETEST_DIR as environment variable or qmake variable to get rid of this message")
|
||||
GOOGLETEST_DIR = C:/Prog/googletest
|
||||
}
|
||||
|
||||
!isEmpty(GOOGLETEST_DIR): {
|
||||
GTEST_SRCDIR = $$GOOGLETEST_DIR/googletest
|
||||
GMOCK_SRCDIR = $$GOOGLETEST_DIR/googlemock
|
||||
}
|
||||
|
||||
requires(exists($$GTEST_SRCDIR):exists($$GMOCK_SRCDIR))
|
||||
|
||||
!exists($$GOOGLETEST_DIR):message("No googletest src dir found - set GOOGLETEST_DIR to enable.")
|
||||
|
||||
DEFINES += \
|
||||
GTEST_LANG_CXX11
|
||||
|
||||
INCLUDEPATH *= \
|
||||
$$GTEST_SRCDIR \
|
||||
$$GTEST_SRCDIR/include \
|
||||
$$GMOCK_SRCDIR \
|
||||
$$GMOCK_SRCDIR/include
|
||||
|
||||
SOURCES += \
|
||||
$$GTEST_SRCDIR/src/gtest-all.cc \
|
||||
$$GMOCK_SRCDIR/src/gmock-all.cc
|
||||
9
tests/auto/mycase/main.cpp
Normal file
9
tests/auto/mycase/main.cpp
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#include "tst_mycase.h"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
||||
13
tests/auto/mycase/mycase.pro
Normal file
13
tests/auto/mycase/mycase.pro
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
include(../gtest_dependency.pri)
|
||||
|
||||
TEMPLATE = app
|
||||
CONFIG += console c++11
|
||||
CONFIG -= app_bundle
|
||||
CONFIG += thread
|
||||
CONFIG += qt
|
||||
|
||||
QT += core
|
||||
|
||||
HEADERS += tst_mycase.h
|
||||
|
||||
SOURCES += main.cpp ../../../src/SqlLexer.cpp
|
||||
28
tests/auto/mycase/tst_mycase.h
Normal file
28
tests/auto/mycase/tst_mycase.h
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <gmock/gmock-matchers.h>
|
||||
#include "../../../src/SqlLexer.h"
|
||||
|
||||
using namespace testing;
|
||||
|
||||
TEST(mycase, myset)
|
||||
{
|
||||
EXPECT_EQ(1, 1);
|
||||
ASSERT_THAT(0, Eq(0));
|
||||
}
|
||||
|
||||
TEST(mycase, lexer)
|
||||
{
|
||||
QString input = " SELECT ";
|
||||
SqlLexer lexer(input, LexerState::Null);
|
||||
|
||||
int startpos, length;
|
||||
BasicTokenType tokentype;
|
||||
QString out;
|
||||
lexer.nextBasicToken(startpos, length, tokentype, out);
|
||||
|
||||
ASSERT_THAT(startpos, Eq(1));
|
||||
ASSERT_THAT(length, Eq(6));
|
||||
ASSERT_THAT(tokentype, Eq(BasicTokenType::Symbol));
|
||||
ASSERT_THAT( out, Eq(QString("SELECT")) );
|
||||
}
|
||||
|
||||
3
tests/tests.pro
Normal file
3
tests/tests.pro
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS += auto
|
||||
Loading…
Add table
Add a link
Reference in a new issue