urbit-ob

JavaScript utilities for phonemic base wrangling.
Log | Files | Refs | README

commit f808c8884968b4cb30119f59f066e5c93cc0d490
parent 2c5c28e55c353c2008af80ab82e2f17afd3862ae
Author: Jared Tobin <jared@jtobin.io>
Date:   Tue, 12 Mar 2019 15:28:24 +1300

Remove research dependencies and tests.

Diffstat:
Mpackage.json | 5+----
Dtest/collide-better.js | 36------------------------------------
Dtest/collide.js | 38--------------------------------------
3 files changed, 1 insertion(+), 78 deletions(-)

diff --git a/package.json b/package.json @@ -16,13 +16,10 @@ "author": "Tlon", "license": "MIT", "devDependencies": { - "better-sqlite3": "^5.4.0", - "bloomfilter": "0.0.18", "chai": "^4.2.0", "jsverify": "^0.8.3", "mocha": "^5.2.0", - "nyc": "^13.1.0", - "sqlite3": "^4.0.6" + "nyc": "^13.1.0" }, "dependencies": { "bn.js": "^4.11.8", diff --git a/test/collide-better.js b/test/collide-better.js @@ -1,36 +0,0 @@ -const BN = require('bn.js') -const Database = require('better-sqlite3') -const fs = require('fs') -const ob = require('../src') - -let db = new Database('patp.db', { memory: false }) - -let lower = Math.pow(2, 16) -let upper = lower + 1000001 // Math.pow(2, 32) - 1 - -let create = db.prepare("CREATE TABLE patp (number INTEGER PRIMARY KEY, patp TEXT)") - -create.run() - -let insert = db.prepare("INSERT INTO patp(number, patp) VALUES (?, ?)") - -let counter = 1 - -for (j = lower; j < upper + 1001; j += 1000) { - db.transaction(_ => { - for (i = j; i < j + 1000; i++) { - if (counter % 10000000 === 0) { console.log(`passed ${counter} planets`) } - insert.run(i, ob.vatp(i)) - counter++ - } - })() -} - -let dups = db.prepare("SELECT * from patp where patp in (select patp from patp group by patp having count(*) > 1)") - -let res = dups.all() - -fs.writeFileSync("./test-duplicates.json", JSON.stringify(res)) - -db.close() - diff --git a/test/collide.js b/test/collide.js @@ -1,38 +0,0 @@ - -const BN = require('bn.js') -const sqlite3 = require('sqlite3') -const fs = require('fs') - -const ob = require('../src') - -let db = new sqlite3.Database(':memory:') - -let lower = Math.pow(2, 16) -let upper = lower + 1000001 // Math.pow(2, 32) - 1 - -db.serialize(function() { - db.run("CREATE TABLE patp (number INT, patp TEXT)") - - db.parallelize(function() { - let stmt = db.prepare("INSERT INTO patp(number, patp) VALUES (?, ?)") - - for (j = lower; j < upper; j++) { - stmt.run(j, ob.vatp(j)) - } - stmt.finalize() - - }) - - let dups = db.prepare("SELECT * from patp where patp in (select patp from patp group by patp having count(*) > 1)") - - dups.all([], function(err, rows) { - if (err) { console.log(err) } - fs.writeFileSync("./test-duplicates.json", JSON.stringify(rows)) - }) - - dups.finalize() - -}) - -db.close() -