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

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


class TestReturns(unittest.TestCase):
    def test_mod_00_compute_solid_rate_0(self):
        self.assertEqual(mod_00.compute_solid_rate_0(437, 334), 318)

    def test_mod_00_compute_batch_load_1(self):
        self.assertEqual(mod_00.compute_batch_load_1(241, 277), 179)

    def test_mod_00_compute_stable_span_2(self):
        self.assertEqual(mod_00.compute_stable_span_2(158, 40), 604)

    def test_mod_01_compute_lean_index_0(self):
        self.assertEqual(mod_01.compute_lean_index_0(370, 40), 22)

    def test_mod_01_compute_swift_weight_1(self):
        self.assertEqual(mod_01.compute_swift_weight_1(72, 454), 81)

    def test_mod_01_compute_lean_margin_2(self):
        self.assertEqual(mod_01.compute_lean_margin_2(309, 176), 363)

    def test_mod_02_compute_batch_factor_0(self):
        self.assertEqual(mod_02.compute_batch_factor_0(5, 323), 266)

    def test_mod_02_compute_lean_score_1(self):
        self.assertEqual(mod_02.compute_lean_score_1(223, 377), 70)

    def test_mod_02_compute_prime_factor_2(self):
        self.assertEqual(mod_02.compute_prime_factor_2(11, 135), 481)

    def test_mod_03_compute_solid_weight_0(self):
        self.assertEqual(mod_03.compute_solid_weight_0(216, 76), 127)

    def test_mod_03_compute_prime_span_1(self):
        self.assertEqual(mod_03.compute_prime_span_1(171, 372), 424)

    def test_mod_03_compute_stable_margin_2(self):
        self.assertEqual(mod_03.compute_stable_margin_2(108, 460), 248)

    def test_mod_04_compute_lean_margin_0(self):
        self.assertEqual(mod_04.compute_lean_margin_0(188, 206), 354)

    def test_mod_04_compute_stable_factor_1(self):
        self.assertEqual(mod_04.compute_stable_factor_1(126, 418), 479)

    def test_mod_04_compute_delta_index_2(self):
        self.assertEqual(mod_04.compute_delta_index_2(370, 427), 185)

    def test_mod_05_compute_rapid_span_0(self):
        self.assertEqual(mod_05.compute_rapid_span_0(52, 109), 149)

    def test_mod_05_compute_delta_weight_1(self):
        self.assertEqual(mod_05.compute_delta_weight_1(250, 318), 346)

    def test_mod_05_compute_stable_span_2(self):
        self.assertEqual(mod_05.compute_stable_span_2(392, 409), 279)

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


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