Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(346)

Unified Diff: third_party/sqlite/sqlite-src-3070603/test/distinctagg.test

Issue 949043002: Add //third_party/sqlite to dirs_to_snapshot, remove net_sql.patch (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/sqlite/sqlite-src-3070603/test/distinctagg.test
diff --git a/third_party/sqlite/sqlite-src-3070603/test/distinctagg.test b/third_party/sqlite/sqlite-src-3070603/test/distinctagg.test
new file mode 100644
index 0000000000000000000000000000000000000000..9b5dc2167822661d99de6b155aa979f3379f379a
--- /dev/null
+++ b/third_party/sqlite/sqlite-src-3070603/test/distinctagg.test
@@ -0,0 +1,62 @@
+# 2005 September 11
+#
+# The author disclaims copyright to this source code. In place of
+# a legal notice, here is a blessing:
+#
+# May you do good and not evil.
+# May you find forgiveness for yourself and forgive others.
+# May you share freely, never taking more than you give.
+#
+#***********************************************************************
+# This file implements regression tests for SQLite library. The
+# focus of this script is the DISTINCT modifier on aggregate functions.
+#
+# $Id: distinctagg.test,v 1.3 2009/02/09 13:19:28 drh Exp $
+
+
+set testdir [file dirname $argv0]
+source $testdir/tester.tcl
+
+do_test distinctagg-1.1 {
+ execsql {
+ CREATE TABLE t1(a,b,c);
+ INSERT INTO t1 VALUES(1,2,3);
+ INSERT INTO t1 VALUES(1,3,4);
+ INSERT INTO t1 VALUES(1,3,5);
+ SELECT count(distinct a),
+ count(distinct b),
+ count(distinct c),
+ count(all a) FROM t1;
+ }
+} {1 2 3 3}
+do_test distinctagg-1.2 {
+ execsql {
+ SELECT b, count(distinct c) FROM t1 GROUP BY b ORDER BY b
+ }
+} {2 1 3 2}
+do_test distinctagg-1.3 {
+ execsql {
+ INSERT INTO t1 SELECT a+1, b+3, c+5 FROM t1;
+ INSERT INTO t1 SELECT a+2, b+6, c+10 FROM t1;
+ INSERT INTO t1 SELECT a+4, b+12, c+20 FROM t1;
+ SELECT count(*), count(distinct a), count(distinct b) FROM t1
+ }
+} {24 8 16}
+do_test distinctagg-1.4 {
+ execsql {
+ SELECT a, count(distinct c) FROM t1 GROUP BY a ORDER BY a
+ }
+} {1 3 2 3 3 3 4 3 5 3 6 3 7 3 8 3}
+
+do_test distinctagg-2.1 {
+ catchsql {
+ SELECT count(distinct) FROM t1;
+ }
+} {1 {DISTINCT aggregates must have exactly one argument}}
+do_test distinctagg-2.2 {
+ catchsql {
+ SELECT group_concat(distinct a,b) FROM t1;
+ }
+} {1 {DISTINCT aggregates must have exactly one argument}}
+
+finish_test

Powered by Google App Engine
This is Rietveld 408576698