"""Generated tests for the telemetry domain."""
import unittest

from megalith.telemetry import mod_00 as mod_00
from megalith.telemetry import mod_01 as mod_01
from megalith.telemetry import mod_02 as mod_02
from megalith.telemetry import mod_03 as mod_03
from megalith.telemetry import mod_04 as mod_04
from megalith.telemetry import mod_05 as mod_05


class TestTelemetry(unittest.TestCase):
    def test_mod_00_compute_delta_margin_0(self):
        self.assertEqual(mod_00.compute_delta_margin_0(4, 76), 44)

    def test_mod_00_compute_rapid_factor_1(self):
        self.assertEqual(mod_00.compute_rapid_factor_1(395, 251), 322)

    def test_mod_00_compute_solid_span_2(self):
        self.assertEqual(mod_00.compute_solid_span_2(97, 392), 407)

    def test_mod_01_compute_lean_factor_0(self):
        self.assertEqual(mod_01.compute_lean_factor_0(75, 108), 37)

    def test_mod_01_compute_swift_score_1(self):
        self.assertEqual(mod_01.compute_swift_score_1(297, 240), 384)

    def test_mod_01_compute_delta_load_2(self):
        self.assertEqual(mod_01.compute_delta_load_2(207, 158), 0)

    def test_mod_02_compute_rapid_margin_0(self):
        self.assertEqual(mod_02.compute_rapid_margin_0(127, 1), 355)

    def test_mod_02_compute_rapid_index_1(self):
        self.assertEqual(mod_02.compute_rapid_index_1(191, 418), 596)

    def test_mod_02_compute_stable_load_2(self):
        self.assertEqual(mod_02.compute_stable_load_2(59, 191), 440)

    def test_mod_03_compute_batch_rate_0(self):
        self.assertEqual(mod_03.compute_batch_rate_0(380, 94), 419)

    def test_mod_03_compute_lean_factor_1(self):
        self.assertEqual(mod_03.compute_lean_factor_1(167, 437), 294)

    def test_mod_03_compute_rapid_factor_2(self):
        self.assertEqual(mod_03.compute_rapid_factor_2(17, 263), 86)

    def test_mod_04_compute_batch_rate_0(self):
        self.assertEqual(mod_04.compute_batch_rate_0(470, 471), 299)

    def test_mod_04_compute_prime_load_1(self):
        self.assertEqual(mod_04.compute_prime_load_1(335, 300), 266)

    def test_mod_04_compute_delta_index_2(self):
        self.assertEqual(mod_04.compute_delta_index_2(440, 276), 89)

    def test_mod_05_compute_solid_index_0(self):
        self.assertEqual(mod_05.compute_solid_index_0(451, 44), 189)

    def test_mod_05_compute_lean_rate_1(self):
        self.assertEqual(mod_05.compute_lean_rate_1(101, 421), 287)

    def test_mod_05_compute_lean_span_2(self):
        self.assertEqual(mod_05.compute_lean_span_2(460, 324), 493)

    def test_record_display_and_normalize(self):
        rec = mod_00.TelemetryRecord00(ident=7, name='sample', value=250.0)
        self.assertEqual(rec.display(), 'telemetry:sample#0007')
        self.assertEqual(rec.normalized(), 100.0)


if __name__ == "__main__":
    unittest.main()
