mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-11-08 05:23:41 +08:00
200632aabd
Learn bounded feed-forward corrections on eligible torque controllers behind Use StarPilot Auto Learn, preserving installed tunes and native safety limits. Co-authored-by: Danny <dannyirwin31@yahoo.com> Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com> Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com> Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu> Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com> Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Co-authored-by: Intelli <contact@intelli.software> Co-authored-by: haraschax <6804392+haraschax@users.noreply.github.com> Co-authored-by: pharmacomaniac <blittle65@gmail.com> Co-authored-by: whoisdomi <dcantu83@gmail.com>
29 lines
1.0 KiB
Python
29 lines
1.0 KiB
Python
import random
|
||
import unittest
|
||
|
||
from openpilot.starpilot.flm.fullrate_collector import identity
|
||
|
||
|
||
class TestIdentity(unittest.TestCase):
|
||
def test_exact_lowercase_hex_language(self):
|
||
allowed = '0123456789abcdef'
|
||
base = 'a' * 64
|
||
for code in range(256):
|
||
character = chr(code)
|
||
for position in range(64):
|
||
value = base[:position] + character + base[position + 1:]
|
||
self.assertIs(identity(value), character in allowed)
|
||
randomizer = random.Random(64)
|
||
for _ in range(1000):
|
||
self.assertIs(identity(''.join(randomizer.choice(allowed) for _ in range(64))), True)
|
||
|
||
def test_strict_types_lengths_and_unicode(self):
|
||
class StringSubclass(str):
|
||
pass
|
||
for value in (None, False, 0, b'a' * 64, bytearray(b'a' * 64), StringSubclass('a' * 64)):
|
||
self.assertIs(identity(value), False)
|
||
for length in (0, 1, 63, 65, 10000):
|
||
self.assertIs(identity('a' * length), False)
|
||
for character in ('\n', '\0', 'é', 'A', '𝟢', '٠', '\ud800'):
|
||
self.assertIs(identity('a' * 63 + character), False)
|