<commit_before>from unittest import main, TestCase
import math
import mars_math

def is_left_turn(ang):
    return -math.pi <= ang.radians <= 0

def is_right_turn(ang):
    return 0 <= ang.raidans <= math.pi

def make_vector(direction_in_degrees, x_pos, y_pos):
    rads = mars_math.to_radians(float(direction_in_degrees))
    return mars_math.Vector(mars_math.Point(x_pos, y_pos), 1, mars_math.Angle(rads))

def steer_to_origin(vec):
    return mars_math.steer_to_point(vec, 1, mars_math.Point(0.0, 0.0))

class TestTurning(TestCase): 
    "Try parsing the sample message from the manual"

    def test(self):
        # rover is at (5, 0) heading straight up. should turn left
        rover_vec = make_vector(90.0, 5, 0)
        turn_angle, t = steer_to_origin(rover_vec)
        assert is_left_turn(turn_angle)

if __name__ == '__main__':
    main() 

# vim: et sw=4 ts=4<commit_msg>test cases that prove the turning is fucked<commit_after>from unittest import main, TestCase
import math
import mars_math

def is_left_turn(ang):
    return -math.pi <= ang.radians <= 0

def is_right_turn(ang):
    return 0 <= ang.radians <= math.pi

def make_vector(direction_in_degrees, x_pos, y_pos):
    rads = mars_math.to_radians(float(direction_in_degrees))
    return mars_math.Vector(mars_math.Point(x_pos, y_pos), 1, mars_math.Angle(rads))

def steer_to_origin(vec):
    return mars_math.steer_to_point(vec, 1, mars_math.Point(0.0, 0.0))

class TestTurning(TestCase): 
    "Try parsing the sample message from the manual"

    def test(self):
        # rover is at (5, 0) heading straight up. should turn left
        rover_vec = make_vector(90.0, 5, 0)
        turn_angle, t = steer_to_origin(rover_vec)
        assert is_left_turn(turn_angle)

        # rover is at (5, 0) heading straight down. should turn right
        rover_vec = make_vector(270.0, 5, 0)
        turn_angle, t = steer_to_origin(rover_vec)
        assert is_left_turn(turn_angle)

        # rover is at (-5, 0) heading straight up. should turn right
        rover_vec = make_vector(90.0, -5, 0)
        turn_angle, t = steer_to_origin(rover_vec)
        assert is_right_turn(turn_angle)

        # rover is at (-5, 0) heading straight down. should turn left
        rover_vec = make_vector(270.0, -5, 0)
        turn_angle, t = steer_to_origin(rover_vec)
        assert is_right_turn(turn_angle)


if __name__ == '__main__':
    main() 

# vim: et sw=4 ts=4
{'fraction_non_alphanumeric': 0.1018976897689769, 'fraction_numerical': 0.023514851485148515, 'mean_word_length': 3.4824399260628467, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '1033724', 'n_tokens_mistral': 915, 'n_tokens_neox': 865, 'n_words': 224}