Esempio n. 1
0
def test_bexa(fx_mchk):
    """
    Test 'mag' for tibibits (1024^6)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "87271233986700065432", "75.70 Eib"
    fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
Esempio n. 2
0
def test_tera(fx_mchk):
    """
    Test 'mag' for terabits (1000^4)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "12390008765432", "12.39 Tb"
    fx_mchk.result = mag.main([fx_mchk.inp], True)
Esempio n. 3
0
def test_giga(fx_mchk):
    """
    Test 'mag' for megabits (1000^3)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "12398765432", "12.40 Gb"
    fx_mchk.result = mag.main([fx_mchk.inp], True)
Esempio n. 4
0
def test_zetta(fx_mchk):
    """
    Test 'mag' for terabits (1000^7)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "43541873239090087685432", "43.54 Zb"
    fx_mchk.result = mag.main([fx_mchk.inp], True)
Esempio n. 5
0
def test_bgiga(fx_mchk):
    """
    Test 'mag' for gibibits (1024^3)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "12398765432", "11.55 Gib"
    fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
Esempio n. 6
0
def test_mega(fx_mchk):
    """
    Test 'mag' for megabits (1000^2)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "98765432", "98.77 Mb"
    fx_mchk.result = mag.main([fx_mchk.inp], True)
Esempio n. 7
0
def test_kilo(fx_mchk):
    """
    Test 'mag' for bits (1000^0)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "98765", "98.77 Kb"
    fx_mchk.result = mag.main([fx_mchk.inp], True)
Esempio n. 8
0
def test_yotta(fx_mchk):
    """
    Test 'mag' for terabits (1000^8)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "75843541873239090087685432", "75.84 Yb"
    fx_mchk.result = mag.main([fx_mchk.inp], True)
Esempio n. 9
0
def test_bbit(fx_mchk):
    """
    Test 'mag' for bits (1024^0)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "999", "999.00 b"
    fx_mchk.result = mag.main([fx_mchk.inp], True)
Esempio n. 10
0
def test_byotta(fx_mchk):
    """
    Test 'mag' for tibibits (1024^8)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "39423487271233986700065432", "32.61 Yib"
    fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
Esempio n. 11
0
def test_exa(fx_mchk):
    """
    Test 'mag' for terabits (1000^6)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "41873239090087685432", "41.87 Eb"
    fx_mchk.result = mag.main([fx_mchk.inp], True)
Esempio n. 12
0
def test_bzetta(fx_mchk):
    """
    Test 'mag' for tibibits (1024^7)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "23487271233986700065432", "19.89 Zib"
    fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
Esempio n. 13
0
def test_bmega(fx_mchk):
    """
    Test 'mag' for mebibits (1024^2)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "98765432", "94.19 Mib"
    fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
Esempio n. 14
0
def test_peta(fx_mchk):
    """
    Test 'mag' for terabits (1000^5)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "17239090087685432", "17.24 Pb"
    fx_mchk.result = mag.main([fx_mchk.inp], True)
Esempio n. 15
0
def test_bpeta(fx_mchk):
    """
    Test 'mag' for tibibits (1024^5)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "71233986700065432", "63.27 Pib"
    fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
Esempio n. 16
0
def test_btera(fx_mchk):
    """
    Test 'mag' for tibibits (1024^4)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "12390008765432", "11.27 Tib"
    fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
Esempio n. 17
0
def test_bkilo(fx_mchk):
    """
    Test 'mag' for kibibits (1024^1)
    """
    pytest.debug_func()
    fx_mchk.inp, fx_mchk.exp = "98765", "96.45 Kib"
    fx_mchk.result = mag.main(["-b", fx_mchk.inp], True)
Esempio n. 18
0
def test_usage(fx_usage):
    """
    'mag' with no args should get the usage message
    """
    pytest.debug_func()
    with pytest.raises(docopt.DocoptExit) as err:
        a = mag.main([])                              # noqa: ignore=F841
    assert "\n".join(fx_usage) == str(err.value)
Esempio n. 19
0
    def magtest(self, string):
        """
        Test 'mag' for a specific value
        """
        d = string.split()
        v = d[0]
        if "i" in d[3]:
            args = ["./mag", "-b", v]
        else:
            args = ["./mag", v]

        a = mag.main(args, True)
        try:
            assert a == string
        except AssertionError:
            print "\nexpected: '%s'" % a
            print "result:   '%s'" % string
Esempio n. 20
0
 def test_giga(self):
     """
     Test 'mag' for gigabits (1000^3)
     """
     a = mag.main(["./mag", "12398765432"], True)
     self.magtest("12398765432 = 12.40 Gb")
Esempio n. 21
0
 def test_tera(self):
     """
     Test 'mag' for terabits (1000^4)
     """
     a = mag.main(["./mag", "12390008765432"], True)
     self.magtest("12390008765432 = 12.39 Tb")
Esempio n. 22
0
 def test_bgiga(self):
     """
     Test 'mag' for gibibits (1024^3)
     """
     a = mag.main(["./mag", "-b", "12398765432"], True)
     self.magtest("12398765432 = 11.55 Gib")
Esempio n. 23
0
 def test_mega(self):
     """
     Test 'mag' for megabits (1000^2)
     """
     a = mag.main(["./mag", "98765432"], True)
     self.magtest("98765432 = 98.77 Mb")
Esempio n. 24
0
 def test_bmega(self):
     """
     Test 'mag' for mebibits (1024^2)
     """
     a = mag.main(["./mag", "-b", "98765432"], True)
     self.magtest("98765432 = 94.19 Mib")
Esempio n. 25
0
 def test_kilo(self):
     """
     Test 'mag' for kilobits (1000^1)
     """
     a = mag.main(["./mag", "98765"], True)
     self.magtest("98765 = 98.77 Kb")
Esempio n. 26
0
 def test_bkilo(self):
     """
     Test 'mag' for kibibits (1024^1)
     """
     a = mag.main(["./mag", "-b", "98765"], True)
     self.magtest("98765 = 96.45 Kib")
Esempio n. 27
0
 def test_usage(self):
     """
     'mag' with no args should get the usage message
     """
     a = mag.main(["./mag"], True)
     assert a == mag.usage()
Esempio n. 28
0
 def test_bbit(self):
     """
     Test 'mag' for bits (1024^0)
     """
     a = mag.main(["./mag", "999", "-b"], True)
     self.magtest("999 = 999.00 b")