/[pcre]/code/trunk/pcrecpp_unittest.cc
ViewVC logotype

Diff of /code/trunk/pcrecpp_unittest.cc

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 179 by ph10, Wed Jun 13 08:53:45 2007 UTC revision 199 by ph10, Tue Jul 31 14:39:09 2007 UTC
# Line 33  Line 33 
33  //  //
34  // TODO: Test extractions for PartialMatch/Consume  // TODO: Test extractions for PartialMatch/Consume
35    
36    #ifdef HAVE_CONFIG_H
37    #include <config.h>
38    #endif
39    
40  #include <stdio.h>  #include <stdio.h>
41  #include <cassert>  #include <cassert>
42  #include <vector>  #include <vector>
 #include "config.h"  
43  #include "pcrecpp.h"  #include "pcrecpp.h"
44    
45  using pcrecpp::StringPiece;  using pcrecpp::StringPiece;
# Line 905  int main(int argc, char** argv) { Line 908  int main(int argc, char** argv) {
908      CHECK(!RE("(\\d+)").FullMatch("4294967296", &v));      CHECK(!RE("(\\d+)").FullMatch("4294967296", &v));
909    }    }
910  #ifdef HAVE_LONG_LONG  #ifdef HAVE_LONG_LONG
911    # if defined(__MINGW__) || defined(__MINGW32__)
912    #   define LLD "%I64d"
913    # else
914    #   define LLD "%lld"
915    # endif
916    {    {
917      long long v;      long long v;
918      static const long long max_value = 0x7fffffffffffffffLL;      static const long long max_value = 0x7fffffffffffffffLL;
# Line 914  int main(int argc, char** argv) { Line 922  int main(int argc, char** argv) {
922      CHECK(RE("(-?\\d+)").FullMatch("100", &v)); CHECK_EQ(v, 100);      CHECK(RE("(-?\\d+)").FullMatch("100", &v)); CHECK_EQ(v, 100);
923      CHECK(RE("(-?\\d+)").FullMatch("-100",&v)); CHECK_EQ(v, -100);      CHECK(RE("(-?\\d+)").FullMatch("-100",&v)); CHECK_EQ(v, -100);
924    
925      snprintf(buf, sizeof(buf), "%lld", max_value);      snprintf(buf, sizeof(buf), LLD, max_value);
926      CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);      CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);
927    
928      snprintf(buf, sizeof(buf), "%lld", min_value);      snprintf(buf, sizeof(buf), LLD, min_value);
929      CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, min_value);      CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, min_value);
930    
931      snprintf(buf, sizeof(buf), "%lld", max_value);      snprintf(buf, sizeof(buf), LLD, max_value);
932      assert(buf[strlen(buf)-1] != '9');      assert(buf[strlen(buf)-1] != '9');
933      buf[strlen(buf)-1]++;      buf[strlen(buf)-1]++;
934      CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));      CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
935    
936      snprintf(buf, sizeof(buf), "%lld", min_value);      snprintf(buf, sizeof(buf), LLD, min_value);
937      assert(buf[strlen(buf)-1] != '9');      assert(buf[strlen(buf)-1] != '9');
938      buf[strlen(buf)-1]++;      buf[strlen(buf)-1]++;
939      CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));      CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));

Legend:
Removed from v.179  
changed lines
  Added in v.199

  ViewVC Help
Powered by ViewVC 1.1.5