Back to index

python3.2  3.2.2
Public Member Functions
test.test_int_literal.TestHexOctBin Class Reference

List of all members.

Public Member Functions

def test_hex_baseline
def test_hex_unsigned
def test_oct_baseline
def test_oct_unsigned
def test_bin_baseline
def test_bin_unsigned

Detailed Description

Definition at line 9 of file test_int_literal.py.


Member Function Documentation

Definition at line 99 of file test_int_literal.py.

00099 
00100     def test_bin_baseline(self):
00101         # A few upper/lowercase tests
00102         self.assertEqual(0b0, 0B0)
00103         self.assertEqual(0b1, 0B1)
00104         self.assertEqual(0b10101010101, 0B10101010101)
00105         # Baseline tests
00106         self.assertEqual(0b0, 0)
00107         self.assertEqual(0b10000, 16)
00108         self.assertEqual(0b1111111111111111111111111111111, 2147483647)
00109         self.assertEqual(0b111111111111111111111111111111111111111111111111111111111111111, 9223372036854775807)
00110         # Ditto with a minus sign and parentheses
00111         self.assertEqual(-(0b0), 0)
00112         self.assertEqual(-(0b10000), -16)
00113         self.assertEqual(-(0b1111111111111111111111111111111), -2147483647)
00114         self.assertEqual(-(0b111111111111111111111111111111111111111111111111111111111111111), -9223372036854775807)
00115         # Ditto with a minus sign and NO parentheses
00116         self.assertEqual(-0b0, 0)
00117         self.assertEqual(-0b10000, -16)
00118         self.assertEqual(-0b1111111111111111111111111111111, -2147483647)
00119         self.assertEqual(-0b111111111111111111111111111111111111111111111111111111111111111, -9223372036854775807)

Here is the call graph for this function:

Definition at line 120 of file test_int_literal.py.

00120 
00121     def test_bin_unsigned(self):
00122         # Positive constants
00123         self.assertEqual(0b10000000000000000000000000000000, 2147483648)
00124         self.assertEqual(0b11111111111111111111111111111111, 4294967295)
00125         # Ditto with a minus sign and parentheses
00126         self.assertEqual(-(0b10000000000000000000000000000000), -2147483648)
00127         self.assertEqual(-(0b11111111111111111111111111111111), -4294967295)
00128         # Ditto with a minus sign and NO parentheses
00129         # This failed in Python 2.2 through 2.2.2 and in 2.3a1
00130         self.assertEqual(-0b10000000000000000000000000000000, -2147483648)
00131         self.assertEqual(-0b11111111111111111111111111111111, -4294967295)
00132 
00133         # Positive constants
00134         self.assertEqual(0b1000000000000000000000000000000000000000000000000000000000000000, 9223372036854775808)
00135         self.assertEqual(0b1111111111111111111111111111111111111111111111111111111111111111, 18446744073709551615)
00136         # Ditto with a minus sign and parentheses
00137         self.assertEqual(-(0b1000000000000000000000000000000000000000000000000000000000000000), -9223372036854775808)
00138         self.assertEqual(-(0b1111111111111111111111111111111111111111111111111111111111111111), -18446744073709551615)
00139         # Ditto with a minus sign and NO parentheses
00140         # This failed in Python 2.2 through 2.2.2 and in 2.3a1
00141         self.assertEqual(-0b1000000000000000000000000000000000000000000000000000000000000000, -9223372036854775808)
00142         self.assertEqual(-0b1111111111111111111111111111111111111111111111111111111111111111, -18446744073709551615)

Here is the call graph for this function:

Definition at line 11 of file test_int_literal.py.

00011 
00012     def test_hex_baseline(self):
00013         # A few upper/lowercase tests
00014         self.assertEqual(0x0, 0X0)
00015         self.assertEqual(0x1, 0X1)
00016         self.assertEqual(0x123456789abcdef, 0X123456789abcdef)
00017         # Baseline tests
00018         self.assertEqual(0x0, 0)
00019         self.assertEqual(0x10, 16)
00020         self.assertEqual(0x7fffffff, 2147483647)
00021         self.assertEqual(0x7fffffffffffffff, 9223372036854775807)
00022         # Ditto with a minus sign and parentheses
00023         self.assertEqual(-(0x0), 0)
00024         self.assertEqual(-(0x10), -16)
00025         self.assertEqual(-(0x7fffffff), -2147483647)
00026         self.assertEqual(-(0x7fffffffffffffff), -9223372036854775807)
00027         # Ditto with a minus sign and NO parentheses
00028         self.assertEqual(-0x0, 0)
00029         self.assertEqual(-0x10, -16)
00030         self.assertEqual(-0x7fffffff, -2147483647)
00031         self.assertEqual(-0x7fffffffffffffff, -9223372036854775807)

Here is the call graph for this function:

Definition at line 32 of file test_int_literal.py.

00032 
00033     def test_hex_unsigned(self):
00034         # Positive constants
00035         self.assertEqual(0x80000000, 2147483648)
00036         self.assertEqual(0xffffffff, 4294967295)
00037         # Ditto with a minus sign and parentheses
00038         self.assertEqual(-(0x80000000), -2147483648)
00039         self.assertEqual(-(0xffffffff), -4294967295)
00040         # Ditto with a minus sign and NO parentheses
00041         # This failed in Python 2.2 through 2.2.2 and in 2.3a1
00042         self.assertEqual(-0x80000000, -2147483648)
00043         self.assertEqual(-0xffffffff, -4294967295)
00044 
00045         # Positive constants
00046         self.assertEqual(0x8000000000000000, 9223372036854775808)
00047         self.assertEqual(0xffffffffffffffff, 18446744073709551615)
00048         # Ditto with a minus sign and parentheses
00049         self.assertEqual(-(0x8000000000000000), -9223372036854775808)
00050         self.assertEqual(-(0xffffffffffffffff), -18446744073709551615)
00051         # Ditto with a minus sign and NO parentheses
00052         # This failed in Python 2.2 through 2.2.2 and in 2.3a1
00053         self.assertEqual(-0x8000000000000000, -9223372036854775808)
00054         self.assertEqual(-0xffffffffffffffff, -18446744073709551615)

Here is the call graph for this function:

Definition at line 55 of file test_int_literal.py.

00055 
00056     def test_oct_baseline(self):
00057         # A few upper/lowercase tests
00058         self.assertEqual(0o0, 0O0)
00059         self.assertEqual(0o1, 0O1)
00060         self.assertEqual(0o1234567, 0O1234567)
00061         # Baseline tests
00062         self.assertEqual(0o0, 0)
00063         self.assertEqual(0o20, 16)
00064         self.assertEqual(0o17777777777, 2147483647)
00065         self.assertEqual(0o777777777777777777777, 9223372036854775807)
00066         # Ditto with a minus sign and parentheses
00067         self.assertEqual(-(0o0), 0)
00068         self.assertEqual(-(0o20), -16)
00069         self.assertEqual(-(0o17777777777), -2147483647)
00070         self.assertEqual(-(0o777777777777777777777), -9223372036854775807)
00071         # Ditto with a minus sign and NO parentheses
00072         self.assertEqual(-0o0, 0)
00073         self.assertEqual(-0o20, -16)
00074         self.assertEqual(-0o17777777777, -2147483647)
00075         self.assertEqual(-0o777777777777777777777, -9223372036854775807)

Here is the call graph for this function:

Definition at line 76 of file test_int_literal.py.

00076 
00077     def test_oct_unsigned(self):
00078         # Positive constants
00079         self.assertEqual(0o20000000000, 2147483648)
00080         self.assertEqual(0o37777777777, 4294967295)
00081         # Ditto with a minus sign and parentheses
00082         self.assertEqual(-(0o20000000000), -2147483648)
00083         self.assertEqual(-(0o37777777777), -4294967295)
00084         # Ditto with a minus sign and NO parentheses
00085         # This failed in Python 2.2 through 2.2.2 and in 2.3a1
00086         self.assertEqual(-0o20000000000, -2147483648)
00087         self.assertEqual(-0o37777777777, -4294967295)
00088 
00089         # Positive constants
00090         self.assertEqual(0o1000000000000000000000, 9223372036854775808)
00091         self.assertEqual(0o1777777777777777777777, 18446744073709551615)
00092         # Ditto with a minus sign and parentheses
00093         self.assertEqual(-(0o1000000000000000000000), -9223372036854775808)
00094         self.assertEqual(-(0o1777777777777777777777), -18446744073709551615)
00095         # Ditto with a minus sign and NO parentheses
00096         # This failed in Python 2.2 through 2.2.2 and in 2.3a1
00097         self.assertEqual(-0o1000000000000000000000, -9223372036854775808)
00098         self.assertEqual(-0o1777777777777777777777, -18446744073709551615)

Here is the call graph for this function:


The documentation for this class was generated from the following file: