-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from NREL/245-tests-for-simdrivelabel
245 tests for simdrivelabel
- Loading branch information
Showing
6 changed files
with
674 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import unittest | ||
import numpy as np | ||
|
||
from fastsim import fastsimrust as fsr | ||
|
||
|
||
class TestSimDriveLabel(unittest.TestCase): | ||
def test_get_label_fe_conv(self): | ||
veh = fsr.RustVehicle.mock_vehicle() | ||
label_fe, _ = fsr.get_label_fe(veh, False, False) # Unpack the tuple | ||
# Because the full test is already implemented in Rust, we | ||
# don't need a comprehensive check here. | ||
self.assertEqual(label_fe.lab_udds_mpgge, 32.47503766676829) | ||
self.assertEqual(label_fe.lab_hwy_mpgge, 42.265348793379445) | ||
self.assertEqual(label_fe.lab_comb_mpgge, 36.25407690819302) | ||
|
||
def test_get_label_fe_phev(self): | ||
# Set up the required parameters and objects needed for testing get_label_fe_phev | ||
veh = fsr.RustVehicle.mock_vehicle() | ||
label_fe, _ = fsr.get_label_fe(veh, False, False) | ||
self.assertEqual(label_fe.adj_udds_mpgge, 25.246151811422468) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.