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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#include <gtest/gtest.h>
#include "util/db/dbconnection.h"
class SqliteLikeTest : public testing::Test {};
TEST_F(SqliteLikeTest, PatternTest) {
QString pattern;
QString string;
QChar esc;
pattern = QString::fromUtf8("%väth%");
string = QString::fromUtf8("Sven Väth");
esc = '\0';
EXPECT_TRUE(mixxx::DbConnection::likeCompareLatinLow(&pattern, &string, esc));
pattern = QString::fromUtf8("%vath%");
string = QString::fromUtf8("Sven Väth");
esc = '\0';
EXPECT_TRUE(mixxx::DbConnection::likeCompareLatinLow(&pattern, &string, esc));
pattern = QString::fromUtf8("%väth%");
string = QString::fromUtf8("Sven Vath");
esc = '\0';
EXPECT_TRUE(mixxx::DbConnection::likeCompareLatinLow(&pattern, &string, esc));
pattern = QString::fromUtf8("%v_th%");
string = QString::fromUtf8("Sven Väth");
esc = '\0';
EXPECT_TRUE(mixxx::DbConnection::likeCompareLatinLow(&pattern, &string, esc));
pattern = QString::fromUtf8("%v_th%%");
string = QString::fromUtf8("Sven Väth");
esc = '\0';
EXPECT_TRUE(mixxx::DbConnection::likeCompareLatinLow(&pattern, &string, esc));
pattern = QString::fromUtf8("%v%_%th%%");
string = QString::fromUtf8("Sven Väth");
esc = '\0';
EXPECT_TRUE(mixxx::DbConnection::likeCompareLatinLow(&pattern, &string, esc));
pattern = QString::fromUtf8("%v!%th%");
string = QString::fromUtf8("Sven V%th");
esc = '!';
EXPECT_TRUE(mixxx::DbConnection::likeCompareLatinLow(&pattern, &string, esc));
pattern = QString::fromUtf8("%ä%");
string = QString::fromUtf8("Tiësto");
esc = '\0';
EXPECT_FALSE(mixxx::DbConnection::likeCompareLatinLow(&pattern, &string, esc));
}
|