summaryrefslogtreecommitdiff
path: root/test/invalid-matrix.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove stray _GNU_SOURCE definitionsEmmanuele Bassi2021-05-011-1/+1
| | | | | | We define _GNU_SOURCE globally in both the Autotools build, through the use of the AC_USE_SYSTEM_EXTENSIONS macro; and in the Meson build, with add_project_arguments().
* test: Define optional exception classesUli Schlachter2012-10-161-4/+0
| | | | | | | | | | | | | | According to musl libc author: "C99 requires the FE_ macros to be defined if and only if the exception they correspond to is supported" So we define these macros to 0 if they are not supported. Support for these FPU exceptions is not necessary for correct functionality, but makes some tests less effective. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=55771 Signed-off-by: Uli Schlachter <psychon@znc.in>
* [test] Fix checking of the fenv.h include.M Joonas Pihlaja2009-06-181-2/+2
| | | | | | | | | | | This adds a configure check for fenv.h and makes invalid-matrix.c check for it with HAVE_FENV_H instead of HAVE_FEDISABLEEXCEPT -- turns out Solaris doesn't have fedisableexcept(), but it does have feclearexcept(). The same issue appears on OSX and was fixed in ab86662ab499e1f29c0f8c4248771e730c281e3f. This patch adds some configure magic.
* [test] Fallback to HUGE_VAL in place of INFINITY in invalid-matrix.c.M Joonas Pihlaja2009-06-181-1/+1
| | | | | GCC 3.4.3 on OpenSolaris does not recognise INFINITY. Use HUGE_VAL instead for every compiler instead of just MSVC.
* [test] Compile fix for invalid-matrixAndrew Lavin2009-06-031-1/+1
| | | | Fixed test compile error on OS X that caused fenv.h not to be included.
* [test] Clear expected floating point exceptionsChris Wilson2009-05-151-0/+4
| | | | | | | | | | test/invalid-matrix deliberately feeds garbage into the API to test our error detection. This causes FPE to be raised during the course of the test - so they are deliberately disable for the duration. However, the exceptions were not being cleared and so the FPE could be triggered on the next floating point operation. This was being masked during make check, by the fact that each test is run in its own forked process and was only observed when multiple tests were run in foreground mode.
* [test] Add cairo_test_NaN and use it in place of strtodJeff Muizelaar2009-02-111-1/+1
| | | | | strtod("NaN") returns 0.0 with the MSVC runtime so we need to generate NaN some other way.
* [test] Define INFINITY on MSVCJeff Muizelaar2009-02-091-2/+2
| | | | 1./0. produces a compiler error on MSVC so we'll use HUGEVAL instead.
* [test] Fix the definition of INFINITYJeff Muizelaar2009-02-051-1/+1
| | | | | In my defence, even with INFINITY as 0, I was seeing new asserts on win32. Caught by Jeremy Lea.
* [test] Define INFINITY if it hasn't been defined.Jeff Muizelaar2009-02-031-20/+2
| | | | This lets us use more of invalid-matrix on win32
* [test] Build test suite into single binary.Chris Wilson2008-10-311-14/+6
| | | | | | | | | Avoid calling libtool to link every single test case, by building just one binary from all the sources. This binary is then given the task of choosing tests to run (based on user selection and individual test requirement), forking each test into its own process and accumulating the results.
* Move _GNU_SOURCE declarations to where it's usedBehdad Esfahbod2008-09-021-1/+4
| | | | Such that we don't rely on more GNU extensions accidentally.
* [test] Preparatory work for running under memfault.Chris Wilson2008-08-131-3/+4
| | | | | | | | | | | | | | | | | | | | In order to run under memfault, the framework is first extended to handle running concurrent tests - i.e. multi-threading. (Not that this is a requirement for memfault, instead it shares a common goal of storing per-test data). To that end all the global data is moved into a per-test context and the targets are adjusted to avoid overlap on shared, global resources (such as output files and frame buffers). In order to preserve the simplicity of the standard draw routines, the context is not passed explicitly as a parameter to the routines, but is instead attached to the cairo_t via the user_data. For the masochist, to enable the tests to be run across multiple threads simply set the environment variable CAIRO_TEST_NUM_THREADS to the desired number. In the long run, we can hope the need for memfault (runtime testing of error paths) will be mitigated by static analysis. A promising candidate for this task would appear to be http://hal.cs.berkeley.edu/cil/.
* [test/invalid-matrix] Disable floating point exception.Chris Wilson2008-05-061-0/+9
| | | | | | | | test/invalid-matrix purposely feeds invalid numbers into cairo, in order to check its detection of garbage values. In doing so, cairo raises an Invalid exception, but as this is a direct result of an abuse of the API we can treat it as expected behaviour and ignore the exception.
* Compile fix for AIX.Shailendra Jain2008-02-151-1/+1
| | | | | | | | Minor correction for a build failure on AIX: "mozilla/gfx/cairo/cairo/src/cairo-gstate.c", line 45.43: 1506-294 (S) Syntax error in expression on #if directive. (Fixes https://bugzilla.mozilla.org/show_bug.cgi?id=415867.)
* [test/invalid-matrix] Test detection of infinities.Chris Wilson2008-02-151-1/+122
| | | | | Feed infinities into the API and check that we correctly return INVALID_MATRIX.
* [test/invalid-matrix] Check scale(0,0)Chris Wilson2008-02-151-0/+16
| | | | | Test that INVALID_MATRIX is returned if the user calls cairo_scale(0,0) or a variant thereof.
* [test/invalid-matrix] Promote incorrect status warning to an error.Chris Wilson2008-02-151-1/+2
| | | | | As the last warning for an incorrect status has been resolved, throw an error if we regress and no longer report an INVALID_MATRIX under testing.
* [test/invalid] Test cairo_translate() and friends for NaN safety.Chris Wilson2008-02-151-0/+37
| | | | | Pass NaNs to cairo_translate() and friends and check that they raise an INVALID_MATRIX error.
* [test/*] Create new surfaces using the group target.Chris Wilson2007-12-201-1/+1
| | | | | | | | | | cairo_get_target() returns the original surface passed to cairo_create(), and not the current destination as required when testing drawing to the same surface using multiple contexts. For completeness we also use the group target when creating similar surfaces within the tests (to check that similar surfaces of similar surfaces also work).
* [cairo-matrix] Check determinant for invalid numbers.Chris Wilson2007-07-051-12/+82
| | | | | | | | | | By checking matrices for invalid determinants, we can prevent the setting and application of invalid matrices. The trick used here is that NaNs, as specified by IEE754, always return FALSE in comparisons. Since we know that the square of the determinant must be positive definite, then if the comparison is FALSE the computation must have resulted in a NaN.
* test/invalid-matrix: Add new test to exercise CAIRO_STATUS_INVALID_MATRIX pathsCarl Worth2007-04-111-0/+142
This new test exercises every path where the user might possibly pass in an invalid matrix. Currently the test fails if no error is reported. Also, if an incorrect error is reported, (such as CAIRO_STATUS_NO_MEMORY instead of CAIRO_STATUS_INVALID_MATRIX), this is logged as a warning in invalid-matrix.log, but the test still passes. It would still be worthwhile to follow up quickly and fix those cases to propagate the correct error value.