summaryrefslogtreecommitdiffstats
path: root/storage/test/unit/test_page_size_is_32k.js
blob: a2548d1e694644202589c05a9fcf6df75169fa40 (plain)
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
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/
 */

// This file tests that dbs are using 32k pagesize

const kExpectedPageSize = 32768; // 32K
const kExpectedCacheSize = -2048; // 2MiB

function check_size(db)
{
  var stmt = db.createStatement("PRAGMA page_size");
  stmt.executeStep();
  do_check_eq(stmt.getInt32(0), kExpectedPageSize);
  stmt.finalize();
  stmt = db.createStatement("PRAGMA cache_size");
  stmt.executeStep();
  do_check_eq(stmt.getInt32(0), kExpectedCacheSize);
  stmt.finalize();
}

function new_file(name)
{
  var file = dirSvc.get("ProfD", Ci.nsIFile);
  file.append(name + ".sqlite");
  do_check_false(file.exists());
  return file;
}

function run_test()
{
  check_size(getDatabase(new_file("shared32k")));
  check_size(getService().openUnsharedDatabase(new_file("unshared32k")));
}