interplane.Get Omega
Read in your language

sqlite

[Ported from github.com/sqlite/sqlite] Fix bugs in and improve the interface to the ".check" command of the CLI.

Brought by drakestapleton

branch master Branches Tags History

sqlite / test / sha1.sql

51 lines · 1419 bytes Raw Blame History
1#!sqlite3
2#
3# 2026-07-29
4#
5# The author disclaims copyright to this source code. In place of
6# a legal notice, here is a blessing:
7#
8# May you do good and not evil.
9# May you find forgiveness for yourself and forgive others.
10# May you share freely, never taking more than you give.
11#
12#***********************************************************************
13#
14# Test cases for the sha1(), sha1b() functions.
15#
16.open :memory:
17.mode list -reset
18.testcase 100
19SELECT sha1('this is a test');
20.check fa26be19de6bff93f70bc2308434e4a440bbad02
21.testcase 110
22SELECT hex(sha1b('this is a test'));
23.check FA26BE19DE6BFF93F70BC2308434E4A440BBAD02
24.testcase 120
25SELECT sha1(x'31323334353637383930');
26.check 01b307acba4f54f55aafc33bb06bbbf6ca803e9a
27.testcase 130
28SELECT sha1(12345*100000 + 67890);
29.check 01b307acba4f54f55aafc33bb06bbbf6ca803e9a
30.testcase 140
31SELECT sha1('');
32.check da39a3ee5e6b4b0d3255bfef95601890afd80709
33.testcase 150
34SELECT sha1(x'');
35.check da39a3ee5e6b4b0d3255bfef95601890afd80709
36
37.testcase 200
38CREATE TABLE t1(x TEXT);
39INSERT INTO t1 VALUES('SELECT sha1_query((SELECT x FROM t1))');
40.check ''
41.testcase 210
42SELECT sha1_query((SELECT x FROM t1));
43.check -glob '*recursive use of sha1_query()*'
44
45.testcase 300
46DELETE FROM t1;
47INSERT INTO t1 VALUES('SELECT sha3_query((SELECT x FROM t1))');
48.check ''
49.testcase 301
50SELECT sha3_query((SELECT x FROM t1));
51.check -glob '*recursive use of sha3_query()*'