LCOV - code coverage report
Current view: top level - tests - test_as2js_version.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 15 15 100.0 %
Date: 2014-11-22 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* test_as2js_version.cpp -- written by Alexis WILKE for Made to Order Software Corp. (c) 2005-2014 */
       2             : 
       3             : /*
       4             : 
       5             : Copyright (c) 2005-2014 Made to Order Software Corp.
       6             : 
       7             : http://snapwebsites.org/project/as2js
       8             : 
       9             : Permission is hereby granted, free of charge, to any
      10             : person obtaining a copy of this software and
      11             : associated documentation files (the "Software"), to
      12             : deal in the Software without restriction, including
      13             : without limitation the rights to use, copy, modify,
      14             : merge, publish, distribute, sublicense, and/or sell
      15             : copies of the Software, and to permit persons to whom
      16             : the Software is furnished to do so, subject to the
      17             : following conditions:
      18             : 
      19             : The above copyright notice and this permission notice
      20             : shall be included in all copies or substantial
      21             : portions of the Software.
      22             : 
      23             : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
      24             : ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
      25             : LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
      26             : FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
      27             : EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
      28             : LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
      29             : WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
      30             : ARISING FROM, OUT OF OR IN CONNECTION WITH THE
      31             : SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
      32             : SOFTWARE.
      33             : 
      34             : */
      35             : 
      36             : #include    "test_as2js_version.h"
      37             : #include    "test_as2js_main.h"
      38             : 
      39             : #include    "as2js/options.h"
      40             : #include    "as2js/exceptions.h"
      41             : #include    "as2js/as2js.h"
      42             : 
      43             : #include    <cstring>
      44             : #include    <algorithm>
      45             : 
      46             : #include    <cppunit/config/SourcePrefix.h>
      47           4 : CPPUNIT_TEST_SUITE_REGISTRATION( As2JsVersionUnitTests );
      48             : 
      49             : 
      50           1 : bool is_dec(char const *s)
      51             : {
      52           3 :     while(*s >= '0' && *s <= '9')
      53             :     {
      54           1 :         ++s;
      55             :     }
      56           1 :     return *s != '\0';
      57             : }
      58             : 
      59             : 
      60             : 
      61           1 : void As2JsVersionUnitTests::test_version()
      62             : {
      63             :     // verify that the library returns the expected version
      64           1 :     std::string v(as2js::as2js_library_version());
      65           1 :     CPPUNIT_ASSERT(v == AS2JS_VERSION);
      66             : 
      67             :     // verify that the version is well formed
      68           2 :     std::stringstream str;
      69           1 :     str << AS2JS_VERSION_MAJOR << "." << AS2JS_VERSION_MINOR << "." << AS2JS_VERSION_PATCH;
      70           1 :     CPPUNIT_ASSERT(v == str.str());
      71             : 
      72           2 :     std::stringstream vers;
      73           1 :     vers << AS2JS_VERSION_MAJOR << AS2JS_VERSION_MINOR << AS2JS_VERSION_PATCH;
      74           2 :     CPPUNIT_ASSERT(is_dec(str.str().c_str()));
      75          13 : }
      76             : 
      77             : 
      78             : 
      79             : 
      80             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.10