Ignore:
Timestamp:
Dec 8, 2007, 4:58:19 AM (14 years ago)
Author:
Peter Johansson
Message:

added function comparing strings with wildcards - needed for #122

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/utility_test.cc

    r439 r507  
    2828
    2929bool test_hex(int, u_int, std::string);
     30bool test_equal(bool, std::string, std::string);
    3031
    3132int main(const int argc,const char* argv[])
     
    3738  ok &= test_hex(16,2, "10");
    3839
     40  ok &= test_equal(true,"peter", "peter");
     41  ok &= test_equal(false,"peter", "peterj");
     42  ok &= test_equal(true,"p*", "peterj");
     43  ok &= test_equal(true,"peter", "p*");
     44  ok &= test_equal(false,"peter", "p*j");
     45
    3946  if (ok)
    4047    return 0;
    4148  return 1;
     49}
     50
     51bool test_equal(bool answ, std::string a, std::string b)
     52{
     53  if (theplu::svndigest::equal(a.begin(), a.end(), b.begin(), b.end())==answ)
     54    return true;
     55  std::cerr << "equal(" << a << ", " << b << ") results "
     56            << theplu::svndigest::equal(a.begin(), a.end(),b.begin(), b.end())
     57            << ". Expects " << answ << std::endl;
     58  return false;
    4259}
    4360
     
    5168  return false;
    5269}
     70
Note: See TracChangeset for help on using the changeset viewer.