<commit_before>{god} = require('../god')
{vector} = require('../god/vector')

exports.test_god = (test, rx) ->
  test 'god exists', (t) ->
    t.ok god, "god"
    t.end()

  test 'god creates root world', (t) ->
    world = god(rx, {key: "value"})
    t.ok world, "world"
    t.equal world.get("key"), "value"
    t.end()

  test 'vector', (t) ->
    v_equal = (v1,v2, msg) ->
      t.equal vector.x(v1), vector.x(v2), "#{msg}[X]"
      t.equal vector.y(v1), vector.y(v2), "#{msg}[Y]"

    a = [0, 1]
    b = [1, 0]
    ra = rx.array a
    
    v_equal a,a, "vector equality"
    t.notOk vector.equal(a,b), "vector inequality"

    v_equal ra, a, "rx vector equality"
    t.notOk vector.equal(ra,b), "rx vector inequality"
    
    v_equal vector.add(a,b), [1,1], 'vector add'

    t.equal vector.angle([ 1, 0]),   0, 'vector angle'
    t.equal vector.angle([ 0, 1]),  90, 'vector angle'
    t.equal vector.angle([-1, 0]), 180, 'vector angle'
    t.equal vector.angle([ 0,-1]), -90, 'vector angle'

    v_equal vector.turn(a, vector.to.left), b, "turn left"
    v_equal vector.turn(b, vector.to.right), a, "turn right"

    fired = false
    err = -> fired = true
    v_equal vector.bound([4,-1], 3, err), [3,0], "bounds check"
    t.v_equal fired, "error callback fired"
    
    t.end()<commit_msg>Re-enable bounds specs correctly<commit_after>{god} = require('../god')
{vector} = require('../god/vector')

exports.test_god = (test, rx) ->
  test 'god exists', (t) ->
    t.ok god, "god"
    t.end()

  test 'god creates root world', (t) ->
    world = god(rx, {key: "value"})
    t.ok world, "world"
    t.equal world.get("key"), "value"
    t.end()

  test 'vector', (t) ->
    v_equal = (v1,v2, msg) ->
      t.equal vector.x(v1), vector.x(v2), "#{msg}[X]"
      t.equal vector.y(v1), vector.y(v2), "#{msg}[Y]"

    a = [0, 1]
    b = [1, 0]
    ra = rx.array a
    
    v_equal a,a, "vector equality"
    t.notOk vector.equal(a,b), "vector inequality"

    v_equal ra, a, "rx vector equality"
    t.notOk vector.equal(ra,b), "rx vector inequality"
    
    v_equal vector.add(a,b), [1,1], 'vector add'

    t.equal vector.angle([ 1, 0]),   0, 'vector angle'
    t.equal vector.angle([ 0, 1]),  90, 'vector angle'
    t.equal vector.angle([-1, 0]), 180, 'vector angle'
    t.equal vector.angle([ 0,-1]), -90, 'vector angle'

    v_equal vector.turn(a, vector.to.left), b, "turn left"
    v_equal vector.turn(b, vector.to.right), a, "turn right"

    fired = false
    err = -> fired = true
    v_equal vector.bound([4,-1], 3, err), [3,0], "bounds check"
    t.ok fired, "error callback fired"
    
    t.end()
{'fraction_non_alphanumeric': 0.20160673297628157, 'fraction_numerical': 0.0252486610558531, 'mean_word_length': 2.6882933709449928, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2610418', 'n_tokens_mistral': 1063, 'n_tokens_neox': 1013, 'n_words': 272}