예제 #1
0
 def test_max_range(self):
   f = fsd.FSD("6A")
   self.assertAlmostEqual(f.max_range(mass=521.8), 41.43, 2)
   f = fsd.FSD("2A")
   self.assertAlmostEqual(f.max_range(mass=20.0), 37.29, 2)
   f = fsd.FSD("2E")
   self.assertAlmostEqual(f.max_range(mass=20.0), 17.21, 2)
예제 #2
0
 def test_range(self):
   f = fsd.FSD("6A")
   self.assertAlmostEqual(f.range(mass=521.8, fuel=32), 39.63, 2)
   self.assertAlmostEqual(f.range(mass=521.8, fuel=16), 40.81, 2)
   self.assertAlmostEqual(f.range(mass=521.8, fuel=12), 41.12, 2)
   self.assertAlmostEqual(f.range(mass=521.8, fuel=8), 41.43, 2)
   f = fsd.FSD("2A")
   self.assertAlmostEqual(f.range(mass=20.0, fuel=4), 32.48, 2)
   self.assertAlmostEqual(f.range(mass=20.0, fuel=2), 35.43, 2)
   self.assertAlmostEqual(f.range(mass=20.0, fuel=1), 37.12, 2)
   f = fsd.FSD("2E")
   self.assertAlmostEqual(f.range(mass=20.0, fuel=4), 14.77, 2)
   self.assertAlmostEqual(f.range(mass=20.0, fuel=2), 16.11, 2)
   self.assertAlmostEqual(f.range(mass=20.0, fuel=1), 16.88, 2)
예제 #3
0
 def test_supercharge(self):
   f = fsd.FSD("6A")
   f.supercharge('D')
   self.assertAlmostEqual(f.range(mass=521.8, fuel=32), 49.54, 2)
   self.assertAlmostEqual(f.cost(41.42, mass=521.8, fuel=32), 5.02, 2)
   wmin, wmax = f.fuel_weight_range(41.41, mass=521.8)
   self.assertAlmostEqual(wmin, 4.40, 2)
   self.assertAlmostEqual(wmax, 140.72, 2)
   f.supercharge(2)
   self.assertAlmostEqual(f.range(mass=521.8, fuel=32), 59.45, 2)
   self.assertAlmostEqual(f.cost(41.42, mass=521.8, fuel=32), 3.13, 2)
   wmin, wmax = f.fuel_weight_range(41.41, mass=521.8)
   self.assertAlmostEqual(wmin, 2.71, 2)
   self.assertAlmostEqual(wmax, 273.22, 2)
   f.supercharge(3)
   self.assertAlmostEqual(f.range(mass=521.8, fuel=32), 79.26, 2)
   self.assertAlmostEqual(f.cost(41.42, mass=521.8, fuel=32), 1.48, 2)
   wmin, wmax = f.fuel_weight_range(41.41, mass=521.8)
   self.assertAlmostEqual(wmin, 1.28, 2)
   self.assertAlmostEqual(wmax, 538.22, 2)
   f.supercharge('N')
   self.assertAlmostEqual(f.range(mass=521.8, fuel=32), 158.53, 2)
   self.assertAlmostEqual(f.cost(41.42, mass=521.8, fuel=32), 0.24, 2)
   wmin, wmax = f.fuel_weight_range(41.41, mass=521.8)
   self.assertAlmostEqual(wmin, 0.21, 2)
   self.assertAlmostEqual(wmax, 1598.25, 2)
예제 #4
0
 def test_boost(self):
   f = fsd.FSD("6A")
   f.range_boost = 10.5
   self.assertAlmostEqual(f.range(mass=521.8, fuel=32), 50.13, 2)
   self.assertAlmostEqual(f.cost(41.42, mass=521.8, fuel=32), 4.87, 2)
   f.supercharge('N')
   self.assertAlmostEqual(f.range(mass=521.8, fuel=32), 200.53, 2)
   self.assertAlmostEqual(f.cost(41.42, mass=521.8, fuel=32), 0.13, 2)
예제 #5
0
 def test_fuel_weight_range(self):
   f = fsd.FSD("6A")
   wmin, wmax = f.fuel_weight_range(41.41, mass=521.8)
   self.assertAlmostEqual(wmin, 7.99, 2)
   self.assertAlmostEqual(wmax, 8.21, 2)
   wmin, wmax = f.fuel_weight_range(15.0, mass=521.8)
   self.assertAlmostEqual(wmin, 0.55, 2)
   self.assertAlmostEqual(wmax, 941.39, 2)
   wmin, wmax = f.fuel_weight_range(300.0, mass=521.8)
   self.assertIsNone(wmin)
   self.assertIsNone(wmax)
   wmin, wmax = f.fuel_weight_range(300.0, mass=521.8, allow_invalid=True)
   self.assertGreater(wmin, 10**10)
   self.assertLess(wmax, 0)
예제 #6
0
파일: main.py 프로젝트: dartharnold/EDTS
def api_jump_range(fsdcls, mass, fuel, cargo, optmod, maxfmod, massmod):
    f = fsd.FSD(fsdcls)
    # Check values make sense
    f.optmass = (f.optmass * (1.0 + float(optmod[:-1]) / 100.0)
                 if '%' in optmod else float(optmod))
    f.maxfuel = (f.maxfuel * (1.0 + float(maxfmod[:-1]) / 100.0)
                 if '%' in maxfmod else float(maxfmod))

    fsdmass = (f.mass * (1.0 + float(massmod[:-1]) / 100.0)
               if '%' in massmod else float(massmod))
    shipmass = mass + (fsdmass - f.mass)

    max_range = f.max_range(shipmass)
    full_range = f.range(shipmass, fuel)
    cargo_range = f.range(shipmass, fuel, cargo)

    result = {'max': max_range, 'full': full_range, 'laden': cargo_range}

    bottle.response.content_type = 'application/json'
    return {'result': result}
예제 #7
0
 def test_cost(self):
   f = fsd.FSD("6A")
   self.assertAlmostEqual(f.cost(41.42, mass=521.8, fuel=8), 8.00, 2)
   self.assertAlmostEqual(f.cost(15.0, mass=521.8, fuel=32), 0.64, 2)
   self.assertAlmostEqual(f.cost(50.0, mass=521.8, fuel=32), 14.64, 2)
   self.assertEqual(f.cost(0.0, mass=521.8, fuel=32), 0.0)
예제 #8
0
 def test_drive(self):
   self.assertEqual(fsd.FSD("6A").drive, "6A")
   self.assertEqual(fsd.FSD("A6").drive, "6A")
   self.assertEqual(fsd.FSD("E2").drive, "2E")