print "==== simple ====" print int(314) == 314 print int(3.14) == 3 print int(314L) == 314 print int(-3.14) == -3 print int(3.9) == 3 print int(-3.9) == -3 print int(3.5) == 3 print int(-3.5) == -3 print int("10",16) == 16L print "==== int with bases ====" print int('100000000000000000000000000000000', 2) == 4294967296L print int('102002022201221111211', 3) == 4294967296L print int('10000000000000000', 4) == 4294967296L print int('32244002423141', 5) == 4294967296L print int('1550104015504', 6) == 4294967296L print int('211301422354', 7) == 4294967296L print int('40000000000', 8) == 4294967296L print int('12068657454', 9) == 4294967296L print int('4294967296', 10) == 4294967296L print int('1904440554', 11) == 4294967296L print int('9ba461594', 12) == 4294967296L print int('535a79889', 13) == 4294967296L print int('2ca5b7464', 14) == 4294967296L print int('1a20dcd81', 15) == 4294967296L print int('100000000', 16) == 4294967296L print int('a7ffda91', 17) == 4294967296L print int('704he7g4', 18) == 4294967296L print int('4f5aff66', 19) == 4294967296L print int('3723ai4g', 20) == 4294967296L print int('281d55i4', 21) == 4294967296L print int('1fj8b184', 22) == 4294967296L print int('1606k7ic', 23) == 4294967296L print int('mb994ag', 24) == 4294967296L print int('hek2mgl', 25) == 4294967296L print int('dnchbnm', 26) == 4294967296L print int('b28jpdm', 27) == 4294967296L print int('8pfgih4', 28) == 4294967296L print int('76beigg', 29) == 4294967296L print int('5qmcpqg', 30) == 4294967296L print int('4q0jto4', 31) == 4294967296L print int('4000000', 32) == 4294967296L print int('3aokq94', 33) == 4294967296L print int('2qhxjli', 34) == 4294967296L print int('2br45qb', 35) == 4294967296L print int('1z141z4', 36) == 4294967296L print int('-100000000000000000000000000000000', 2) == -4294967296L print int('-102002022201221111211', 3) == -4294967296L print int('-10000000000000000', 4) == -4294967296L print int('-32244002423141', 5) == -4294967296L print int('-1550104015504', 6) == -4294967296L print int('-211301422354', 7) == -4294967296L print int('-40000000000', 8) == -4294967296L print int('-12068657454', 9) == -4294967296L print int('-4294967296', 10) == -4294967296L print int('-1904440554', 11) == -4294967296L print int('-9ba461594', 12) == -4294967296L print int('-535a79889', 13) == -4294967296L print int('-2ca5b7464', 14) == -4294967296L print int('-1a20dcd81', 15) == -4294967296L print int('-100000000', 16) == -4294967296L print int('-a7ffda91', 17) == -4294967296L print int('-704he7g4', 18) == -4294967296L print int('-4f5aff66', 19) == -4294967296L print int('-3723ai4g', 20) == -4294967296L print int('-281d55i4', 21) == -4294967296L print int('-1fj8b184', 22) == -4294967296L print int('-1606k7ic', 23) == -4294967296L print int('-mb994ag', 24) == -4294967296L print int('-hek2mgl', 25) == -4294967296L print int('-dnchbnm', 26) == -4294967296L print int('-b28jpdm', 27) == -4294967296L print int('-8pfgih4', 28) == -4294967296L print int('-76beigg', 29) == -4294967296L print int('-5qmcpqg', 30) == -4294967296L print int('-4q0jto4', 31) == -4294967296L print int('-4000000', 32) == -4294967296L print int('-3aokq94', 33) == -4294967296L print int('-2qhxjli', 34) == -4294967296L print int('-2br45qb', 35) == -4294967296L print int('-1z141z4', 36) == -4294967296L print "==== long with bases ====" print long('100000000000000000000000000000000', 2) == 4294967296L print long('102002022201221111211', 3) == 4294967296L print long('10000000000000000', 4) == 4294967296L print long('32244002423141', 5) == 4294967296L print long('1550104015504', 6) == 4294967296L print long('211301422354', 7) == 4294967296L print long('40000000000', 8) == 4294967296L print long('12068657454', 9) == 4294967296L print long('4294967296', 10) == 4294967296L print long('1904440554', 11) == 4294967296L print long('9ba461594', 12) == 4294967296L print long('535a79889', 13) == 4294967296L print long('2ca5b7464', 14) == 4294967296L print long('1a20dcd81', 15) == 4294967296L print long('100000000', 16) == 4294967296L print long('a7ffda91', 17) == 4294967296L print long('704he7g4', 18) == 4294967296L print long('4f5aff66', 19) == 4294967296L print long('3723ai4g', 20) == 4294967296L print long('281d55i4', 21) == 4294967296L print long('1fj8b184', 22) == 4294967296L print long('1606k7ic', 23) == 4294967296L print long('mb994ag', 24) == 4294967296L print long('hek2mgl', 25) == 4294967296L print long('dnchbnm', 26) == 4294967296L print long('b28jpdm', 27) == 4294967296L print long('8pfgih4', 28) == 4294967296L print long('76beigg', 29) == 4294967296L print long('5qmcpqg', 30) == 4294967296L print long('4q0jto4', 31) == 4294967296L print long('4000000', 32) == 4294967296L print long('3aokq94', 33) == 4294967296L print long('2qhxjli', 34) == 4294967296L print long('2br45qb', 35) == 4294967296L print long('1z141z4', 36) == 4294967296L print "==== simple truncation ====" print int(1.2) == 1 print int('100', 2) == 4 print long(1.2) == 1 print long('100', 2) == 4 print "==== base 0 ====" print int(' 0123 ', 0) == 83 print int(' 0123 ', 0) == 83 print int('000', 0) == 0 print int('0o123', 0) == 83 print int('0x123', 0) == 291 print int('0b100', 0) == 4 print int(' 0O123 ', 0) == 83 print int(' 0X123 ', 0) == 291 print int(' 0B100 ', 0) == 4 print int('0', 0) == 0 print int('+0', 0) == 0 print int('-0', 0) == 0 print int('00', 0) == 0 print "==== base 10 ====" print int('0123') == 123 print int('0123', 10) == 123 print "==== base with prefix ====" print int('0x123', 16) == 291 print int('0o123', 8) == 83 print int('0b100', 2) == 4 print int('0X123', 16) == 291 print int('0O123', 8) == 83 print int('0B100', 2) == 4 print "==== int -> long ====" print int('1' * 600)