fix encoding and rb tree tests

This commit is contained in:
Kevin Jahns
2017-10-15 12:17:25 +02:00
parent 0e426f8928
commit 4eec8ecdd3
15 changed files with 151 additions and 175 deletions

View File

@@ -10,7 +10,7 @@ export default class ID {
return new ID(this.user, this.clock)
}
equals (id) {
return id !== null && id.user === this.user && id.clock === this.user
return id !== null && id.user === this.user && id.clock === this.clock
}
lessThan (id) {
return this.user < id.user || (this.user === id.user && this.clock < id.clock)

View File

@@ -232,11 +232,11 @@ export default class Tree {
findNode (id) {
var o = this.root
if (o === null) {
return false
return null
} else {
while (true) {
if (o === null) {
return false
return null
}
if (id.lessThan(o.val.id)) {
o = o.left
@@ -249,9 +249,6 @@ export default class Tree {
}
}
delete (id) {
if (id == null || id.constructor !== Array) {
throw new Error('id is expected to be an Array!')
}
var d = this.findNode(id)
if (d == null) {
// throw new Error('Element does not exist!')