add test for installed library
This commit is contained in:
parent
ad072dd79d
commit
ef7c3cf349
|
@ -1,4 +1,6 @@
|
|||
|
||||
language: cpp
|
||||
|
||||
install:
|
||||
- sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
|
||||
- sudo apt-get -qq update
|
||||
|
@ -9,12 +11,9 @@ install:
|
|||
- which g++
|
||||
- g++ -v
|
||||
|
||||
language: cpp
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
|
||||
script:
|
||||
- make
|
||||
- sudo make install
|
||||
- make test
|
5
Makefile
5
Makefile
|
@ -62,6 +62,11 @@ format:
|
|||
test: $(BIN)/sql_tests $(BIN)/sql_grammar_test
|
||||
bash test/test.sh
|
||||
|
||||
# test whete
|
||||
test_install:
|
||||
make -C example/
|
||||
./example/example "SELECT * FROM students WHERE name = 'Max Mustermann';"
|
||||
|
||||
$(BIN)/sql_tests: library
|
||||
@mkdir -p $(BIN)/
|
||||
$(CC) $(CTESTFLAGS) $(TESTCPP) test/sql_tests.cpp -o $(BIN)/sql_tests -lsqlparser
|
||||
|
|
|
@ -16,20 +16,21 @@ int main(int argc, char *argv[]) {
|
|||
std::string query = argv[1];
|
||||
|
||||
// parse a given query
|
||||
hsql::SQLStatementList* result = hsql::SQLParser::parseSQLString(query);
|
||||
hsql::SQLParserResult* result = hsql::SQLParser::parseSQLString(query);
|
||||
|
||||
// check whether the parsing was successful
|
||||
if (result->isValid) {
|
||||
printf("Parsed successfully!\n");
|
||||
printf("Number of statements: %lu\n", result->numStatements());
|
||||
printf("Number of statements: %lu\n", result->size());
|
||||
|
||||
for (hsql::SQLStatement* stmt : result->statements) {
|
||||
// process the statements...
|
||||
hsql::printStatementInfo(stmt);
|
||||
}
|
||||
} else {
|
||||
printf("Invalid SQL!\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
printf("Invalid SQL!\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
|
@ -1,3 +1,4 @@
|
|||
#!/bin/bash
|
||||
|
||||
# has to be executed from the root of the repository
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./
|
||||
|
|
Loading…
Reference in New Issue