LCOV - code coverage report
Current view: directory - js/src/jsapi-tests - testIntTypesABI.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 3 3 100.0 %
Date: 2012-06-02 Functions: 8 6 75.0 %

       1                 : #include "tests.h"
       2                 : 
       3                 : /*
       4                 :  * This test exercises the full, deliberately-exposed JSAPI interface to ensure
       5                 :  * that no internal integer typedefs leak out.  Include every intentionally
       6                 :  * public header file (and those headers included by them, for completeness),
       7                 :  * even the ones tests.h itself included, to verify this.
       8                 :  */
       9                 : #include "js-config.h"
      10                 : #include "jsapi.h"
      11                 : #include "jsclass.h"
      12                 : #include "jscpucfg.h"
      13                 : #include "jspubtd.h"
      14                 : #include "jstypes.h"
      15                 : #include "jsval.h"
      16                 : #include "jsxdrapi.h"
      17                 : 
      18                 : #include "js/HashTable.h"
      19                 : #include "js/MemoryMetrics.h"
      20                 : #include "js/TemplateLib.h"
      21                 : #include "js/Utility.h"
      22                 : #include "js/Vector.h"
      23                 : 
      24                 : /*
      25                 :  * Verify that our public (and intended to be public, versus being that way
      26                 :  * because we haven't made them private yet) headers don't define
      27                 :  * {u,}int{8,16,32,64} or JS{Ui,I}nt{8,16,32,64} types.  If any do, they will
      28                 :  * assuredly conflict with a corresponding typedef below mapping to a *struct*.
      29                 :  *
      30                 :  * Note that tests.h includes a few internal headers; in order that this
      31                 :  * jsapi-test be writable, those internal headers must not import the legacy
      32                 :  * typedefs.
      33                 :  */
      34                 : 
      35                 : struct ConflictingType {
      36                 :     uint64_t u64;
      37                 : };
      38                 : 
      39                 : typedef ConflictingType uint8;
      40                 : typedef ConflictingType uint16;
      41                 : typedef ConflictingType uint32;
      42                 : typedef ConflictingType uint64;
      43                 : 
      44                 : typedef ConflictingType int8;
      45                 : typedef ConflictingType int16;
      46                 : typedef ConflictingType int32;
      47                 : typedef ConflictingType int64;
      48                 : 
      49                 : typedef ConflictingType JSUint8;
      50                 : typedef ConflictingType JSUint16;
      51                 : typedef ConflictingType JSUint32;
      52                 : typedef ConflictingType JSUint64;
      53                 : 
      54                 : typedef ConflictingType JSInt8;
      55                 : typedef ConflictingType JSInt16;
      56                 : typedef ConflictingType JSInt32;
      57                 : typedef ConflictingType JSInt64;
      58                 : 
      59                 : typedef ConflictingType jsword;
      60                 : typedef ConflictingType jsuword;
      61                 : typedef ConflictingType JSWord;
      62                 : typedef ConflictingType JSUword;
      63                 : 
      64               4 : BEGIN_TEST(testIntTypesABI)
      65                 : {
      66                 :     /* This passes if the typedefs didn't conflict at compile time. */
      67               1 :     return true;
      68                 : }
      69               2 : END_TEST(testIntTypesABI)

Generated by: LCOV version 1.7