LCOV - app.info - js/src/jsapi-tests/testIntString.cpp

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

           1                 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
           2                 :  * vim: set ts=8 sw=4 et tw=99:
           3                 :  */
           4                 :
           5                 : #include "tests.h"
           6                 : #include "vm/String.h"
           7                 :
           8               4 : BEGIN_TEST(testIntString_bug515273)
           9                 : {
          10               2 :     jsvalRoot v(cx);
          11                 :
          12               1 :     EVAL("'1';", v.addr());
          13               1 :     JSString *str = JSVAL_TO_STRING(v.value());
          14               1 :     CHECK(JS_StringHasBeenInterned(cx, str));
          15               1 :     CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "1"));
          16                 :
          17               1 :     EVAL("'42';", v.addr());
          18               1 :     str = JSVAL_TO_STRING(v.value());
          19               1 :     CHECK(JS_StringHasBeenInterned(cx, str));
          20               1 :     CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "42"));
          21                 :
          22               1 :     EVAL("'111';", v.addr());
          23               1 :     str = JSVAL_TO_STRING(v.value());
          24               1 :     CHECK(JS_StringHasBeenInterned(cx, str));
          25               1 :     CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "111"));
          26                 :
          27                 :     /* Test other types of static strings. */
          28               1 :     EVAL("'a';", v.addr());
          29               1 :     str = JSVAL_TO_STRING(v.value());
          30               1 :     CHECK(JS_StringHasBeenInterned(cx, str));
          31               1 :     CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "a"));
          32                 :
          33               1 :     EVAL("'bc';", v.addr());
          34               1 :     str = JSVAL_TO_STRING(v.value());
          35               1 :     CHECK(JS_StringHasBeenInterned(cx, str));
          36               1 :     CHECK(JS_FlatStringEqualsAscii(JS_ASSERT_STRING_IS_FLAT(str), "bc"));
          37                 :
          38               1 :     return true;
          39                 : }
          40               2 : END_TEST(testIntString_bug515273)

Generated by: LCOV version 1.7