Skip to content

Commit

Permalink
Tdd: timing-array works
Browse files Browse the repository at this point in the history
  • Loading branch information
brownman committed Dec 5, 2012
1 parent a196d2e commit 03b67a2
Showing 1 changed file with 27 additions and 19 deletions.
46 changes: 27 additions & 19 deletions spec/javascripts/models/sound_spec.js.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@
size = 3
min = 0
max = 10
arr = @s1.create_arr_of_gap(min,max,size)
ar = [min , size , max]
arr = @s1.create_arr_of_gap(ar)
expect(arr).toEqual([2.5,5,7.5])
#expect(@comment.errors).toEqual false
#expect(@comment.errors).toEqual false
Expand All @@ -55,28 +56,35 @@
expect(index).toEqual(1)

it "should group undefined in array", ->
arr = [1,undefined, undefined, 2]

# for i in [0...arr.length]
# if arr[i] == undefined
t_arr = []
stack = 0
for i in [0...arr.length]
if(arr[i] != undefined)
if stack !=0
n_arr = []
n_arr.push stack
t_arr.push(n_arr)
stack = 0
t_arr.push arr[i]
else
stack += 1
arr = [1,undefined,undefined,4]

t_arr = @s1.group_undefineds(arr)

res = [1, [1,2,4], 4]
expect(t_arr).toEqual(res)

expect(t_arr).toEqual([1,[2],2])
it "should calculate values of sub-arrays, givven: min, max and length", ->

arr = [1, [1,2,4], 4]
#expect(t_arr).toEqual(res)
#res2 = @s1.replace_groups(res)
res2 = []
end = arr.length
for i in [0...end]
if (typeof arr[i] == 'object')
group = arr[i]
calc = @s1.create_arr_of_gap(group)
res2.push calc



else
res2.push arr[i]

it "should calculate values of sub-arrays"
res3 = _.flatten res2
expect(res3).toEqual([1,2,3,4])
#if arr[i] is type Array:
#find min, max ,length
#than replace arr[i] with calculated array


0 comments on commit 03b67a2

Please sign in to comment.