<commit_before>desc: Test basic geometry operators
tests:
  # Distance
  # coerce_to('STRING') because the test utility has some issues with rounding and I'm too lazy to investigate that now.
  - cd: r.distance(r.point(37, -122), r.point(37, -123)).coerce_to('STRING')
    ot: ("89011.262538353315904")
  - cd: r.distance(r.point(37, -122), r.point(36, -122)).coerce_to('STRING')
    ot: ("110968.30443995493988")
  - cd: r.distance(r.point(37, -122), r.point(36, -122)).eq(r.distance(r.point(36, -122), r.point(37, -122)))
    ot: true
  - cd: r.point(37, -122).distance(r.point(37, -123)).coerce_to('STRING')
    ot: ("89011.262538353315904")
  - def: someDist = r.distance(r.point(37, -122), r.point(37, -123))
    js: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), {unit:'m'}))
    py: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), unit='m'))
    rb: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), :unit=>'m'))
    ot: true
  - js: someDist.mul(1.0/1000.0).eq(r.distance(r.point(37, -122), r.point(37, -123), {unit:'km'}))
    py: someDist.mul(1.0/1000.0).eq(r.distance(r.point(37, -122), r.point(37, -123), unit='km'))
    rb: someDist.mul(1.0/1000.0).eq(r.distance(r.point(37, -122), r.point(37, -123), :unit=>'km'))
    ot: true
  - js: someDist.mul(1.0/1609.344).eq(r.distance(r.point(37, -122), r.point(37, -123), {unit:'mi'}))
    py: someDist.mul(1.0/1609.344).eq(r.distance(r.point(37, -122), r.point(37, -123), unit='mi'))
    rb: someDist.mul(1.0/1609.344).eq(r.distance(r.point(37, -122), r.point(37, -123), :unit=>'mi'))
    ot: true
  - js: someDist.mul(1.0/0.3048).eq(r.distance(r.point(37, -122), r.point(37, -123), {unit:'ft'}))
    py: someDist.mul(1.0/0.3048).eq(r.distance(r.point(37, -122), r.point(37, -123), unit='ft'))
    rb: someDist.mul(1.0/0.3048).eq(r.distance(r.point(37, -122), r.point(37, -123), :unit=>'ft'))
    ot: true
  - js: someDist.mul(1.0/1852.0).eq(r.distance(r.point(37, -122), r.point(37, -123), {unit:'nm'}))
    py: someDist.mul(1.0/1852.0).eq(r.distance(r.point(37, -122), r.point(37, -123), unit='nm'))
    rb: someDist.mul(1.0/1852.0).eq(r.distance(r.point(37, -122), r.point(37, -123), :unit=>'nm'))
    ot: true
  - js: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), {geo_system:'WGS84'}))
    py: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), geo_system='WGS84'))
    rb: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), :geo_system=>'WGS84'))
    ot: true
  # Mearth is a small planet, just 1/10th of earth's size.
  - js: someDist.div(10).eq(r.distance(r.point(37, -122), r.point(37, -123), {geo_system:{'a':637813.7, 'f':(1.0/298.257223563)}}))
    py: someDist.div(10).eq(r.distance(r.point(37, -122), r.point(37, -123), geo_system={'a':637813.7, 'f':(1.0/298.257223563)}))
    rb: someDist.div(10).eq(r.distance(r.point(37, -122), r.point(37, -123), :geo_system=>{'a':637813.7, 'f':(1.0/298.257223563)}))
    ot: true
  - py: r.distance(r.point(37, -122), r.point(37, -123), geo_system='unit_sphere').coerce_to('STRING')
    rb: r.distance(r.point(37, -122), r.point(37, -123), :geo_system=>'unit_sphere').coerce_to('STRING')
    ot: ("0.01393875509649327056")

  # Fill
  - js: r.rectangle([0,0], [1,1], {fill:false}).eq(r.rectangle([0,0], [1,1], {fill:true}))
    py: r.rectangle([0,0], [1,1], fill=false).eq(r.rectangle([0,0], [1,1], fill=true))
    rb: r.rectangle([0,0], [1,1], :fill=>false).eq(r.rectangle([0,0], [1,1], :fill=>true))
    ot: false
  - js: r.rectangle([0,0], [1,1], {fill:false}).fill().eq(r.rectangle([0,0], [1,1], {fill:true}))
    py: r.rectangle([0,0], [1,1], fill=false).fill().eq(r.rectangle([0,0], [1,1], fill=true))
    rb: r.rectangle([0,0], [1,1], :fill=>false).fill().eq(r.rectangle([0,0], [1,1], :fill=>true))
    ot: true

  # Subtraction
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([0.1,0.1], [0.9,0.9]))
    ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0,0],[1,0],[1,1],[0,1],[0,0]],[[0.1,0.1],[0.9,0.1],[0.9,0.9],[0.1,0.9],[0.1,0.1]]], 'type':'Polygon'})
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([0.0,0.1], [0.9,0.9]))
    ot: err('RqlRuntimeError', 'The subtrahend is not contained in the minuend.', [0])
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([0,0], [2,2]))
    ot: err('RqlRuntimeError', 'The subtrahend is not contained in the minuend.', [0])
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([-2,0], [-1,1]))
    ot: err('RqlRuntimeError', 'The subtrahend is not contained in the minuend.', [0])
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([-1,0], [0,1]))
    ot: err('RqlRuntimeError', 'The subtrahend is not contained in the minuend.', [0])
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([-1,0.1], [0.5,0.9]))
    ot: err('RqlRuntimeError', 'The subtrahend is not contained in the minuend.', [0])
  - cd: r.rectangle([0,0], [1,1]).sub(r.polygon([0,0],[0.9,0.1],[0.9,0.9],[0.1,0.9]))
    ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0,0],[1,0],[1,1],[0,1],[0,0]],[[0,0],[0.1,0.9],[0.9,0.9],[0.9,0.1],[0,0]]], 'type':'Polygon'})
<commit_msg>More distance tests<commit_after>desc: Test basic geometry operators
tests:
  # Distance
  # coerce_to('STRING') because the test utility has some issues with rounding and I'm too lazy to investigate that now.
  - cd: r.distance(r.point(37, -122), r.point(37, -123)).coerce_to('STRING')
    ot: ("89011.262538353315904")
  - cd: r.distance(r.point(37, -122), r.point(36, -122)).coerce_to('STRING')
    ot: ("110968.30443995493988")
  - cd: r.distance(r.point(37, -122), r.point(36, -122)).eq(r.distance(r.point(36, -122), r.point(37, -122)))
    ot: true
  - cd: r.point(37, -122).distance(r.point(37, -123)).coerce_to('STRING')
    ot: ("89011.262538353315904")
  - def: someDist = r.distance(r.point(37, -122), r.point(37, -123))
    js: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), {unit:'m'}))
    py: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), unit='m'))
    rb: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), :unit=>'m'))
    ot: true
  - js: someDist.mul(1.0/1000.0).eq(r.distance(r.point(37, -122), r.point(37, -123), {unit:'km'}))
    py: someDist.mul(1.0/1000.0).eq(r.distance(r.point(37, -122), r.point(37, -123), unit='km'))
    rb: someDist.mul(1.0/1000.0).eq(r.distance(r.point(37, -122), r.point(37, -123), :unit=>'km'))
    ot: true
  - js: someDist.mul(1.0/1609.344).eq(r.distance(r.point(37, -122), r.point(37, -123), {unit:'mi'}))
    py: someDist.mul(1.0/1609.344).eq(r.distance(r.point(37, -122), r.point(37, -123), unit='mi'))
    rb: someDist.mul(1.0/1609.344).eq(r.distance(r.point(37, -122), r.point(37, -123), :unit=>'mi'))
    ot: true
  - js: someDist.mul(1.0/0.3048).eq(r.distance(r.point(37, -122), r.point(37, -123), {unit:'ft'}))
    py: someDist.mul(1.0/0.3048).eq(r.distance(r.point(37, -122), r.point(37, -123), unit='ft'))
    rb: someDist.mul(1.0/0.3048).eq(r.distance(r.point(37, -122), r.point(37, -123), :unit=>'ft'))
    ot: true
  - js: someDist.mul(1.0/1852.0).eq(r.distance(r.point(37, -122), r.point(37, -123), {unit:'nm'}))
    py: someDist.mul(1.0/1852.0).eq(r.distance(r.point(37, -122), r.point(37, -123), unit='nm'))
    rb: someDist.mul(1.0/1852.0).eq(r.distance(r.point(37, -122), r.point(37, -123), :unit=>'nm'))
    ot: true
  - js: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), {geo_system:'WGS84'}))
    py: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), geo_system='WGS84'))
    rb: someDist.eq(r.distance(r.point(37, -122), r.point(37, -123), :geo_system=>'WGS84'))
    ot: true
  # Mearth is a small planet, just 1/10th of earth's size.
  - js: someDist.div(10).eq(r.distance(r.point(37, -122), r.point(37, -123), {geo_system:{'a':637813.7, 'f':(1.0/298.257223563)}}))
    py: someDist.div(10).eq(r.distance(r.point(37, -122), r.point(37, -123), geo_system={'a':637813.7, 'f':(1.0/298.257223563)}))
    rb: someDist.div(10).eq(r.distance(r.point(37, -122), r.point(37, -123), :geo_system=>{'a':637813.7, 'f':(1.0/298.257223563)}))
    ot: true
  - py: r.distance(r.point(37, -122), r.point(37, -123), geo_system='unit_sphere').coerce_to('STRING')
    rb: r.distance(r.point(37, -122), r.point(37, -123), :geo_system=>'unit_sphere').coerce_to('STRING')
    ot: ("0.01393875509649327056")
  - cd: r.distance(r.point(0, 0), r.point(0, 0)).coerce_to('STRING')
    ot: ("0")
  # These two give the earth's circumference through the poles
  - cd: r.distance(r.point(0, 0), r.point(0, 180)).mul(2).coerce_to('STRING')
    ot: ("40007862.91725089401")
  - cd: r.distance(r.point(-90, 0), r.point(90, 0)).mul(2).coerce_to('STRING')
    ot: ("40007862.91725089401")
  - cd: r.distance(r.point(0, 0), r.line([0,0], [0,1])).coerce_to('STRING')
    ot: ("0")
  - cd: r.distance(r.line([0,0], [0,1]), r.point(0, 0)).coerce_to('STRING')
    ot: ("0")
  - cd: r.distance(r.point(0, 0), r.line([0,0.1], [0,1])).eq(r.distance(r.point(0, 0), r.point(0, 0.1)))
    ot: true
  - cd: r.distance(r.point(0, 0), r.line([-1,5], [2,4])).coerce_to('STRING')
    ot: ("492471.49900552548934")
  - cd: r.distance(r.point(0, 0), r.polygon([-1,5], [2,4], [10,10])).coerce_to('STRING')
    ot: ("492471.49900552548934")
  - cd: r.distance(r.point(0, 0), r.polygon([-1,0], [1,0], [10,10])).coerce_to('STRING')
    ot: ("0")
  - cd: r.distance(r.point(0.5, 0.5), r.polygon([-1,0], [1,0], [10,10])).coerce_to('STRING')
    ot: ("0")

  # Fill
  - js: r.rectangle([0,0], [1,1], {fill:false}).eq(r.rectangle([0,0], [1,1], {fill:true}))
    py: r.rectangle([0,0], [1,1], fill=false).eq(r.rectangle([0,0], [1,1], fill=true))
    rb: r.rectangle([0,0], [1,1], :fill=>false).eq(r.rectangle([0,0], [1,1], :fill=>true))
    ot: false
  - js: r.rectangle([0,0], [1,1], {fill:false}).fill().eq(r.rectangle([0,0], [1,1], {fill:true}))
    py: r.rectangle([0,0], [1,1], fill=false).fill().eq(r.rectangle([0,0], [1,1], fill=true))
    rb: r.rectangle([0,0], [1,1], :fill=>false).fill().eq(r.rectangle([0,0], [1,1], :fill=>true))
    ot: true

  # Subtraction
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([0.1,0.1], [0.9,0.9]))
    ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0,0],[1,0],[1,1],[0,1],[0,0]],[[0.1,0.1],[0.9,0.1],[0.9,0.9],[0.1,0.9],[0.1,0.1]]], 'type':'Polygon'})
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([0.0,0.1], [0.9,0.9]))
    ot: err('RqlRuntimeError', 'The subtrahend is not contained in the minuend.', [0])
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([0,0], [2,2]))
    ot: err('RqlRuntimeError', 'The subtrahend is not contained in the minuend.', [0])
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([-2,0], [-1,1]))
    ot: err('RqlRuntimeError', 'The subtrahend is not contained in the minuend.', [0])
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([-1,0], [0,1]))
    ot: err('RqlRuntimeError', 'The subtrahend is not contained in the minuend.', [0])
  - cd: r.rectangle([0,0], [1,1]).sub(r.rectangle([-1,0.1], [0.5,0.9]))
    ot: err('RqlRuntimeError', 'The subtrahend is not contained in the minuend.', [0])
  - cd: r.rectangle([0,0], [1,1]).sub(r.polygon([0,0],[0.9,0.1],[0.9,0.9],[0.1,0.9]))
    ot: ({'$reql_type$':'GEOMETRY', 'coordinates':[[[0,0],[1,0],[1,1],[0,1],[0,0]],[[0,0],[0.1,0.9],[0.9,0.9],[0.9,0.1],[0,0]]], 'type':'Polygon'})

{'fraction_non_alphanumeric': 0.2846611599609202, 'fraction_numerical': 0.14326316724398258, 'mean_word_length': 4.278949835911861, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 27, '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': '5699389', 'n_tokens_mistral': 5931, 'n_tokens_neox': 5187, 'n_words': 807}