Dorian 0d073fa89e Add comprehensive installation and setup documentation
- Add GETTING_STARTED.md with quick start guide and development modes
- Add INSTALL.sh automated installation script
- Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md
- Add QUICK_REFERENCE.md for common commands
- Add SETUP_GUIDE.md with detailed setup instructions
- Update README.md with improved project overview
- Add did-wallet app dependencies and node_modules
2026-01-27 17:18:21 +00:00

65 lines
1.2 KiB
JavaScript

'use strict'
const test = require('tape')
const SparseArray = require('../')
let arr
test('allows to be constructed', (t) => {
arr = new SparseArray()
t.end()
})
test('bit field is empty', (t) => {
t.deepEqual(arr.bitField(), [])
t.end()
})
test('one item at 0 position', (t) => {
arr.set(0, 0)
t.deepEqual(arr.bitField(), [0b1])
t.end()
})
test('another item at 1 position', (t) => {
arr.set(1, 1)
t.deepEqual(arr.bitField(), [0b11])
t.end()
})
test('another item at 7th position', (t) => {
arr.set(6, 6)
t.deepEqual(arr.bitField(), [0b1000011])
t.end()
})
test('another item at 8th position', (t) => {
arr.set(7, 7)
t.deepEqual(arr.bitField(), [0b11000011])
t.end()
})
test('another item at 9th position', (t) => {
arr.set(8, 8)
t.deepEqual(arr.bitField(), [0b11000011, 0b1])
t.end()
})
test('another item at 11th position', (t) => {
arr.set(10, 10)
t.deepEqual(arr.bitField(), [0b11000011, 0b101])
t.end()
})
test('another item at 16th position', (t) => {
arr.set(15, 15)
t.deepEqual(arr.bitField(), [0b11000011, 0b10000101])
t.end()
})
test('another item at 17th position', (t) => {
arr.set(16, 16)
t.deepEqual(arr.bitField(), [0b11000011, 0b10000101, 0b1])
t.end()
})