/[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 201 by ph10, Thu Aug 2 08:37:31 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    #   define LLU "%I64u"
914    # else
915    #   define LLD "%lld"
916    #   define LLU "%llu"
917    # endif
918    {    {
919      long long v;      long long v;
920      static const long long max_value = 0x7fffffffffffffffLL;      static const long long max_value = 0x7fffffffffffffffLL;
# Line 914  int main(int argc, char** argv) { Line 924  int main(int argc, char** argv) {
924      CHECK(RE("(-?\\d+)").FullMatch("100", &v)); CHECK_EQ(v, 100);      CHECK(RE("(-?\\d+)").FullMatch("100", &v)); CHECK_EQ(v, 100);
925      CHECK(RE("(-?\\d+)").FullMatch("-100",&v)); CHECK_EQ(v, -100);      CHECK(RE("(-?\\d+)").FullMatch("-100",&v)); CHECK_EQ(v, -100);
926    
927      snprintf(buf, sizeof(buf), "%lld", max_value);      snprintf(buf, sizeof(buf), LLD, max_value);
928      CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);      CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);
929    
930      snprintf(buf, sizeof(buf), "%lld", min_value);      snprintf(buf, sizeof(buf), LLD, min_value);
931      CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, min_value);      CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, min_value);
932    
933      snprintf(buf, sizeof(buf), "%lld", max_value);      snprintf(buf, sizeof(buf), LLD, max_value);
934      assert(buf[strlen(buf)-1] != '9');      assert(buf[strlen(buf)-1] != '9');
935      buf[strlen(buf)-1]++;      buf[strlen(buf)-1]++;
936      CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));      CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
937    
938      snprintf(buf, sizeof(buf), "%lld", min_value);      snprintf(buf, sizeof(buf), LLD, min_value);
939      assert(buf[strlen(buf)-1] != '9');      assert(buf[strlen(buf)-1] != '9');
940      buf[strlen(buf)-1]++;      buf[strlen(buf)-1]++;
941      CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));      CHECK(!RE("(-?\\d+)").FullMatch(buf, &v));
# Line 941  int main(int argc, char** argv) { Line 951  int main(int argc, char** argv) {
951      CHECK(RE("(-?\\d+)").FullMatch("100",&v)); CHECK_EQ(v, 100);      CHECK(RE("(-?\\d+)").FullMatch("100",&v)); CHECK_EQ(v, 100);
952      CHECK(RE("(-?\\d+)").FullMatch("-100",&v2)); CHECK_EQ(v2, -100);      CHECK(RE("(-?\\d+)").FullMatch("-100",&v2)); CHECK_EQ(v2, -100);
953    
954      snprintf(buf, sizeof(buf), "%llu", max_value);      snprintf(buf, sizeof(buf), LLU, max_value);
955      CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);      CHECK(RE("(-?\\d+)").FullMatch(buf,&v)); CHECK_EQ(v, max_value);
956    
957      assert(buf[strlen(buf)-1] != '9');      assert(buf[strlen(buf)-1] != '9');

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

  ViewVC Help
Powered by ViewVC 1.1.5