Description: Avoid privacy breach in documentation
Forwarded: no
Author: Jonas Smedegaard <dr@jones.dk>
Last-Update: 2019-10-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/test/test.js
+++ b/test/test.js
@@ -3,7 +3,6 @@
 var makeTree = require("../rbtree.js")
 var tape = require("tape")
 var util = require("util")
-var iota = require("iota-array")
 
 var COLORS = [ "r", "b", "bb" ]
 
@@ -99,84 +98,6 @@
   t.end()
 })
 
-tape("foreach", function(t) {
-  var u = iota(31).reduce(function(u, k, v) {
-    return u.insert(k, v)
-  }, makeTree())
-
-  //Check basic foreach
-  var visit_keys = []
-  var visit_vals = []
-  u.forEach(function(k,v) {
-    visit_keys.push(k)
-    visit_vals.push(v)
-  })
-  t.same(visit_keys, u.keys)
-  t.same(visit_vals, u.values)
-
-  //Check foreach with termination
-  visit_keys = []
-  visit_vals = []
-  t.equals(u.forEach(function(k,v) {
-    if(k === 5) {
-      return 1000
-    }
-    visit_keys.push(k)
-    visit_vals.push(v)
-  }), 1000)
-  t.same(visit_keys, u.keys.slice(0, 5))
-  t.same(visit_vals, u.values.slice(0, 5))
-
-  //Check half interval foreach
-  visit_keys = []
-  visit_vals = []
-  u.forEach(function(k,v) {
-    visit_keys.push(k)
-    visit_vals.push(v)
-  }, 3)
-  t.same(visit_keys, u.keys.slice(3))
-  t.same(visit_vals, u.values.slice(3))
-
-  //Check half interval foreach with termination
-  visit_keys = []
-  visit_vals = []
-  t.equals(u.forEach(function(k,v) {
-    if(k === 12) {
-      return 1000
-    }
-    visit_keys.push(k)
-    visit_vals.push(v)
-  }, 3), 1000)
-  t.same(visit_keys, u.keys.slice(3, 12))
-  t.same(visit_vals, u.values.slice(3, 12))
-
-
-  //Check interval foreach
-  visit_keys = []
-  visit_vals = []
-  u.forEach(function(k,v) {
-    visit_keys.push(k)
-    visit_vals.push(v)
-  }, 3, 15)
-  t.same(visit_keys, u.keys.slice(3, 15))
-  t.same(visit_vals, u.values.slice(3, 15))
-
-  //Check interval foreach with termination
-  visit_keys = []
-  visit_vals = []
-  t.equals(u.forEach(function(k,v) {
-    if(k === 12) {
-      return 1000
-    }
-    visit_keys.push(k)
-    visit_vals.push(v)
-  }, 3, 15), 1000)
-  t.same(visit_keys, u.keys.slice(3, 12))
-  t.same(visit_vals, u.values.slice(3, 12))
-
-  t.end()
-})
-
 function compareIterators(a, b, t) {
   t.equals(a.tree, b.tree, "iter trees")
   t.equals(a.valid, b.valid, "iter validity")
@@ -189,59 +110,6 @@
   t.equals(a.index, b.index, "iter index")
 }
 
-tape("iterators", function(t) {
-  var u = iota(20).reduce(function(u, k, v) {
-    return u.insert(k, v)
-  }, makeTree())
-
-  //Try walking forward
-  var iter = u.begin
-  var c = iter.clone()
-  t.ok(iter.hasNext, "must have next at beginneing")
-  t.ok(!iter.hasPrev, "must not have predecessor")
-  for(var i=0; i<20; ++i) {
-    var v = u.at(i)
-    compareIterators(iter, v, t)
-    t.equals(iter.index, i)
-    iter.next()
-  }
-  t.ok(!iter.valid, "must be eof iterator")
-
-  //Check if the clone worked
-  compareIterators(c, u.begin, t)
-
-  //Try walking backward
-  var iter = u.end
-  t.ok(!iter.hasNext, "must not have next")
-  t.ok(iter.hasPrev, "must have predecessor")
-  for(var i=19; i>=0; --i) {
-    var v = u.at(i)
-    compareIterators(iter, v, t)
-    t.equals(iter.index, i)
-    iter.prev()
-  }
-  t.ok(!iter.valid, "must be eof iterator")
-
-  t.end()
-})
-
-
-tape("remove()", function(t) {
-
-  var sz = [1, 2,  10, 20, 23, 31, 32, 33]
-  for(var n=0; n<sz.length; ++n) {
-    var c = sz[n]
-    var u = iota(c).reduce(function(u, k, v) {
-      return u.insert(k, v)
-    }, makeTree())
-    for(var i=0; i<c; ++i) {
-      checkTree(u.remove(i), t)
-    }
-  }
-
-  t.end()
-})
-
 tape("update()", function(t) {
   var arr = [0, 1, 2, 3, 4, 5, 6 ]
   var u = arr.reduce(function(u, k, v) {
@@ -258,36 +126,6 @@
   t.end()
 })
 
-
-tape("keys and values", function(t) {
-
-  var original_keys = [ "potato", "sock", "foot", "apple", "newspaper", "gameboy" ]
-  var original_values = [ 42, 10, false, "!!!", {}, null ]
-
-  var u = makeTree()
-  for(var i=0; i<original_keys.length; ++i) {
-    u = u.insert(original_keys[i], original_values[i])
-  }
-
-  var zipped = iota(6).map(function(i) {
-    return [ original_keys[i], original_values[i] ]
-  })
-
-  zipped.sort(function(a,b) {
-    if(a[0] < b[0]) { return -1 }
-    if(a[0] > b[0]) { return 1 }
-    return 0
-  })
-
-  var keys = zipped.map(function(v) { return v[0] })
-  var values = zipped.map(function(v) { return v[1] })
-
-  t.same(u.keys, keys)
-  t.same(u.values, values)
-
-  t.end()
-})
-
 tape("searching", function(t) {
 
   var arr = [0, 1, 1, 1, 1, 2, 3, 4, 5, 6, 6 ]
