Commit c7724b5c authored by Boxiang Sun's avatar Boxiang Sun

add and enable some tests

parent e6ba3768
# expected: fail
"""Tests for Lib/fractions.py."""
from decimal import Decimal
......
# expected: fail
import unittest
import sys
......@@ -17,7 +16,10 @@ class Frm(object):
return self.format % self.args
# SHIFT should match the value in longintrepr.h for best testing.
SHIFT = sys.long_info.bits_per_digit
SHIFT = 64
# Pyston changes: Pyston long implementation not based on digits.
# disable it for now.
# SHIFT = sys.long_info.bits_per_digit
BASE = 2 ** SHIFT
MASK = BASE - 1
KARATSUBA_CUTOFF = 70 # from longobject.c
......
......@@ -1281,7 +1281,9 @@ loghelper(PyObject* arg, double (*func)(double), char *funcname)
Py_ssize_t e;
/* Negative or zero inputs give a ValueError. */
if (Py_SIZE(arg) <= 0) {
// Pyston change: use _PyLong_Sign instead of Py_SIZE to check
// the sign of long object.
if (_PyLong_Sign(arg) <= 0) {
PyErr_SetString(PyExc_ValueError,
"math domain error");
return NULL;
......
......@@ -101,7 +101,6 @@ test_file_eintr not sure
test_fileio [unknown]
test_file wontfix: we don't destruct file objects when the test wants
test_fork1 [unknown]
test_fractions [unknown]
test_frozen [unknown]
test_ftplib [unknown]
test_funcattrs we don't allow changing numing of function defaults
......@@ -141,7 +140,6 @@ test__locale No module named _locale
test_locale [unknown]
test_longexp [unknown]
test_long_future [unknown]
test_long sys.long_info
test_macos Not really a failure, but it tries to skip itself and we don't support that
test_macostools Not really a failure, but it tries to skip itself and we don't support that
test_mailbox [unknown]
......@@ -187,7 +185,6 @@ test_runpy [unknown]
test_sax [unknown]
test_scope eval of code object from existing function (not currently supported)
test_scriptpackages [unknown]
test_set lots of set issues
test_shelve [unknown]
test_shlex [unknown]
test_signal [unknown]
......
import sys
import os
import subprocess
me = sys.executable
file_path = os.path.dirname(__file__)
with open('/dev/null')as ignore:
def run(args):
process = subprocess.Popen([me] + args,
stdout=subprocess.PIPE,
stderr=ignore)
out, err = process.communicate()
sys.stdout.flush()
print(out)
sys.stdout.flush()
run(["".join([file_path, "/no_main_directory"])])
run(["".join([file_path, "/no_main_directory/sub_dir"])])
......@@ -146,3 +146,19 @@ print(long(unicode("-3")))
print(long(x=10))
print(long(x="10", base=10))
try:
print(long('hek2mgl', 22))
except Exception as e:
print(e.message)
print(long('hek2mgl', 23))
print(long('hek2mgl', 24))
for i in range(-10, 10):
print(hash((-1 << 63) + i))
print(hash((1 << 63) + i))
for i in xrange(100):
for j in xrange(100):
print i, j, hash((1 << i) - (1 << j))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment