[pypy-svn] r15099 - in pypy/dist/pypy/translator/c: src test

arigo at codespeak.net arigo at codespeak.net
Tue Jul 26 12:44:14 CEST 2005


Author: arigo
Date: Tue Jul 26 12:44:12 2005
New Revision: 15099

Modified:
   pypy/dist/pypy/translator/c/src/ll_math.h
   pypy/dist/pypy/translator/c/test/test_extfunc.py
Log:
* ANSI C fix in ll_math.h.
* added a test for os.path.exists() in genc, but disabled it and other
  tests handling strings for now, until we have properly zero-terminated
  C strings.

(cfbolz, arigo)


Modified: pypy/dist/pypy/translator/c/src/ll_math.h
==============================================================================
--- pypy/dist/pypy/translator/c/src/ll_math.h	(original)
+++ pypy/dist/pypy/translator/c/src/ll_math.h	Tue Jul 26 12:44:12 2005
@@ -18,7 +18,7 @@
   return ceil(x);
 }
 
-struct RPyFREXP_RESULT* LL_math_frexp(double x) {
+RPyFREXP_RESULT* LL_math_frexp(double x) {
   int expo;
   double m = frexp(x, &expo);
   return ll_frexp_result(m, expo);
@@ -40,7 +40,7 @@
   return ldexp(x, (int) y);
 }
 
-struct RPyMODF_RESULT* LL_math_modf(double x) {
+RPyMODF_RESULT* LL_math_modf(double x) {
   double intpart;
   double fracpart = modf(x, &intpart);
   return ll_modf_result(fracpart, intpart);

Modified: pypy/dist/pypy/translator/c/test/test_extfunc.py
==============================================================================
--- pypy/dist/pypy/translator/c/test/test_extfunc.py	(original)
+++ pypy/dist/pypy/translator/c/test/test_extfunc.py	Tue Jul 26 12:44:12 2005
@@ -16,7 +16,7 @@
     assert t0 <= t1 <= t2
 
 
-def test_os_open():
+def INPROGRESStest_os_open():
     tmpfile = str(udir.join('test_os_open.txt'))
     def does_stuff():
         fd = os.open(tmpfile, os.O_WRONLY | os.O_CREAT, 0777)
@@ -27,7 +27,7 @@
     os.close(fd)
     assert os.path.exists(tmpfile)
 
-def test_failing_os_open():
+def INPROGRESStest_failing_os_open():
     tmpfile = str(udir.join('test_failing_os_open.DOESNTEXIST'))
     def does_stuff():
         fd = os.open(tmpfile, os.O_RDONLY, 0777)
@@ -37,7 +37,7 @@
     py.test.raises(OSError, f1)
     assert not os.path.exists(tmpfile)
 
-def test_open_read_write_close():
+def INPROGRESStest_open_read_write_close():
     filename = str(udir.join('test_open_read_write_close.txt'))
     def does_stuff():
         fd = os.open(filename, os.O_WRONLY | os.O_CREAT, 0777)
@@ -54,7 +54,7 @@
     assert open(filename, 'r').read() == "hello world\n"
     os.unlink(filename)
 
-def test_os_stat():
+def INPROGRESStest_os_stat():
     filename = str(py.magic.autopath())
     def call_stat():
         st = os.stat(filename)
@@ -65,7 +65,7 @@
     assert result[1] == os.stat(filename)[1]
     assert result[2] == os.stat(filename)[2]
 
-def test_os_fstat():
+def INPROGRESStest_os_fstat():
     filename = str(py.magic.autopath())
     def call_fstat():
         fd = os.open(filename, os.O_RDONLY, 0777)
@@ -105,3 +105,12 @@
     f = compile(fn, [float])
     assert f(10.123) == modf(10.123)
 
+def INPROGRESStest_os_path_exists():
+    tmpfile = str(udir.join('test_os_path_exists.TMP'))
+    def fn():
+        return os.path.exists(tmpfile)
+    f = compile(fn, [])
+    open(tmpfile, 'w').close()
+    assert f() is True
+    os.unlink(tmpfile)
+    assert f() is False



More information about the Pypy-commit mailing list