mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-26 22:09:58 -06:00
@@ -518,3 +518,17 @@ void TestTable::moduloOperator()
|
||||
QCOMPARE(tab.fields.at(0).type(), "INTEGER");
|
||||
QCOMPARE(tab.fields.at(0).defaultValue(), "(7%2)");
|
||||
}
|
||||
|
||||
void TestTable::complexExpression()
|
||||
{
|
||||
std::string sql = "CREATE TABLE test(\n"
|
||||
"uuid INTEGER DEFAULT (hex(randomblob(4))||'-'||hex(randomblob(2))||'-'||'4'||substr(hex(randomblob(2)),2)||'-'||substr('AB89',1+(abs(random())%4),1)||substr(hex(randomblob(2)),2)||'-'||hex(randomblob(6)))\n"
|
||||
");";
|
||||
|
||||
Table tab = *(std::dynamic_pointer_cast<sqlb::Table>(Table::parseSQL(sql)));
|
||||
QCOMPARE(tab.name(), "test");
|
||||
|
||||
QCOMPARE(tab.fields.at(0).name(), "uuid");
|
||||
QCOMPARE(tab.fields.at(0).type(), "INTEGER");
|
||||
QCOMPARE(tab.fields.at(0).defaultValue(), "(hex(randomblob(4))||'-'||hex(randomblob(2))||'-'||'4'||substr(hex(randomblob(2)),2)||'-'||substr('AB89',1+(abs(random())%4),1)||substr(hex(randomblob(2)),2)||'-'||hex(randomblob(6)))");
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ private slots:
|
||||
void datetimeExpression();
|
||||
void extraParentheses();
|
||||
void moduloOperator();
|
||||
void complexExpression();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user