Mercurial > hg > vampy-host
changeset 113:1c7c4bd74363
Fix RealTime compare (& thus the tests, for Py2 anyway)
author | Chris Cannam |
---|---|
date | Wed, 17 Jun 2015 12:43:01 +0100 |
parents | 9343eee50605 |
children | 7f03d095a8b1 |
files | native/PyRealTime.cpp test/test_collect.py |
diffstat | 2 files changed, 9 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/native/PyRealTime.cpp Wed Jun 17 12:35:41 2015 +0100 +++ b/native/PyRealTime.cpp Wed Jun 17 12:43:01 2015 +0100 @@ -234,8 +234,12 @@ return Py_False; } - RealTime *a = PyRealTime_AS_REALTIME(self); - RealTime *b = PyRealTime_AS_REALTIME(other); + RealTime *ap = PyRealTime_AS_REALTIME(self); + RealTime *bp = PyRealTime_AS_REALTIME(other); + + if (!ap || !bp) return Py_False; + const RealTime &a = *ap; + const RealTime &b = *bp; if (op == Py_LT) { return (a < b) ? Py_True : Py_False; @@ -395,7 +399,8 @@ if (!PyRealTime_Check(s)) { PyErr_SetString(PyExc_TypeError, "RealTime Object Expected."); cerr << "in call PyRealTime_AsPointer(): RealTime Object Expected. " << endl; - return NULL; } + return NULL; + } return s->rt; };
--- a/test/test_collect.py Wed Jun 17 12:35:41 2015 +0100 +++ b/test/test_collect.py Wed Jun 17 12:43:01 2015 +0100 @@ -62,6 +62,7 @@ assert len(results) == 10 i = 0 for r in results: + print("timestamp = " + str(r["timestamp"])) assert r["timestamp"] == vamp.vampyhost.RealTime('seconds', i * 0.75) assert abs(r["values"][0] - i * 0.1) < eps i = i + 1