refactoring text types

This commit is contained in:
DadaMonad
2015-02-17 21:10:46 +00:00
parent c65f11b308
commit 5ba0a7492a
16 changed files with 1432 additions and 1570 deletions

View File

@@ -11,8 +11,8 @@ Connector = require "../../y-test/lib/y-test.coffee"
module.exports = class Test
constructor: (@name_suffix = "")->
@number_of_test_cases_multiplier = 1
@repeat_this = 3 * @number_of_test_cases_multiplier
@doSomething_amount = 123 * @number_of_test_cases_multiplier
@repeat_this = 1 * @number_of_test_cases_multiplier
@doSomething_amount = 1230 * @number_of_test_cases_multiplier
@number_of_engines = 5 + @number_of_test_cases_multiplier - 1
@time = 0 # denotes to the time when run was started

View File

@@ -117,5 +117,51 @@ describe "TextFramework", ->
it "can handle many engines, many operations, concurrently (random)", ->
console.log("testiy deleted this TODO:dtrn")
@yTest.run()
it "handles double-late-join", ->
test = new TextTest("double")
test.run()
@yTest.run()
u1 = test.users[0]
u2 = @yTest.users[1]
ops1 = u1.HB._encode()
ops2 = u2.HB._encode()
u1.engine.applyOp ops2, true
u2.engine.applyOp ops1, true
compare = (o1, o2)->
if o1.type? and o1.type isnt o2.type
throw new Error "different types"
else if o1.type is "Object"
for name, val of o1.val()
compare(val, o2.val(name))
else if o1.type?
compare(o1.val(), o2.val())
else if o1 isnt o2
throw new Error "different values"
compare u1, u2
expect(test.getContent(0)).to.deep.equal(@yTest.getContent(1))