       #icosa.rebuild()
 
 
-    # Is there a (high-level) way of getting the faces ?
-    # Is it the model's job ?
-
     it "should be 20", ->
       #fixme
 


  describe "its vertices", ->

    vertices = null;

    beforeEach ->
      vertices = getIcosahedronVerticesAsVectors icosa

    it "should be 12", ->
      console.log 'vertices', vertices
      expect(vertices.length).toBe(60) # 20 faces, 3 vertices each
      # test that the 60 vertices are actually 12
#      uniqueVertices = unique vertices
#      expect(uniqueVertices.length).toBe(12)

    it "should all have the size of the icosahedron as length", ->
      for v in vertices


###
Costly, for testing

@param  {Jax.Mesh}
@return {Array} of 3D vectors
###
getMeshVerticesAsVectors = (mesh) ->
  [vertices, vector] = [ [], [] ]
  i = 0

  for coordinate in mesh.data.vertexWrapper.buffer # or mesh.data.vertexBuffer ?

    vector.push coordinate
    i++

    if i > 2
      vertices.push( vec3.create vector )
      vector.length = i =0

  vertices


###
Returns an array containing the elements of iterable, without any doubles
Todo: make results of the same type as iterable

@param {Array|Object} iterable
@return {Array}
###
unique = (iterable) ->
  results = []

  contains = (haystack, needle) ->
    for straw in haystack
      match = true
      for value, key in needle
        match = false unless straw[key] == value
      return true if match
    false

  for item in iterable
    results.push(item) unless contains(results, item)

  results

