File: sql_parse.cpp

package info (click to toggle)
mapnik 4.2.1%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 18,592 kB
  • sloc: cpp: 163,859; python: 1,332; sh: 690; xml: 161; makefile: 123; perl: 28; lisp: 13
file content (37 lines) | stat: -rw-r--r-- 973 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

#include "catch.hpp"

#include <mapnik/sql_utils.hpp>

TEST_CASE("sql parse")
{
    SECTION("table")
    {
        std::string subquery("table");
        REQUIRE(subquery == mapnik::sql_utils::table_from_sql(subquery));
    }

    SECTION("complex sql 1")
    {
        std::string subquery("(select * FROM table1, table2) AS data");
        REQUIRE("table1" == mapnik::sql_utils::table_from_sql(subquery));
    }

    SECTION("complex sql 2")
    {
        std::string subquery("(select * FROM table1 , table2) AS data");
        REQUIRE("table1" == mapnik::sql_utils::table_from_sql(subquery));
    }

    SECTION("complex sql 3")
    {
        std::string subquery("(select * FROM table1,table2) AS data");
        REQUIRE("table1" == mapnik::sql_utils::table_from_sql(subquery));
    }

    SECTION("complex sql 4")
    {
        std::string subquery("(select * FROM table1) AS data");
        REQUIRE("table1" == mapnik::sql_utils::table_from_sql(subquery));
    }
}