[robotpy] Mirror most other subprojects (#8208)

GitOrigin-RevId: ac60fd3cf4a24023184376687da28373d14b781a

This mirrors the robotpy files for the following projects:
- apriltag
- datalog
- hal
- ntcore
- romiVendordep
- wpilibc
- wpimath
- xrpVendordep

This excludes cscore and the halsim wrappers for at this time.

NOTE: This does not hook these projects up to the build system, just simply mirrors the files. The building will take place in a follow up PR to make it easier to review the changes necessary to build.
This commit is contained in:
PJ Reiniger
2025-10-24 01:28:04 -04:00
committed by GitHub
parent 8992dcdc99
commit 44b9cc1398
545 changed files with 27293 additions and 38 deletions

View File

@@ -0,0 +1,71 @@
import pytest
import wpimath_test
def test_units_attributes():
assert wpimath_test.SomeClass.s_constant == 2
assert wpimath_test.SomeClass.ms_constant1 == 20 # the unit is ms, not seconds
assert wpimath_test.SomeClass.ms_constant2 == 0.050
assert wpimath_test.SomeClass.ms_constant3 == 200
def test_units_check_default_by_name1():
sc = wpimath_test.SomeClass()
assert sc.checkDefaultByName1(0.020) == True
assert sc.checkDefaultByName1() == True
with pytest.raises(RuntimeError):
sc.checkDefaultByName1(100)
def test_units_check_default_by_name2():
sc = wpimath_test.SomeClass()
assert sc.checkDefaultByName2(0.050) == True
assert sc.checkDefaultByName2() == True
with pytest.raises(RuntimeError):
sc.checkDefaultByName2(100)
def test_units_check_default_by_num1():
sc = wpimath_test.SomeClass()
assert sc.checkDefaultByNum1(0.050) == True
assert sc.checkDefaultByNum1() == True
with pytest.raises(RuntimeError):
sc.checkDefaultByNum1(100)
def test_units_check_default_by_num2():
sc = wpimath_test.SomeClass()
assert sc.checkDefaultByNum2(0.050) == True
assert sc.checkDefaultByNum2() == True
with pytest.raises(RuntimeError):
sc.checkDefaultByNum2(100)
def test_units_ft():
assert wpimath_test.SomeClass.five_ft == 5.0
def test_units_ft2m():
sc = wpimath_test.SomeClass()
assert sc.ft2m(3) == 0.9144
def test_units_ms2s():
sc = wpimath_test.SomeClass()
assert sc.ms2s(20) == 0.020
def test_units_s2ms():
sc = wpimath_test.SomeClass()
assert sc.s2ms(0.2) == 200.0