~ubuntu-branches/debian/lenny/exiv2/lenny

« back to all changes in this revision

Viewing changes to src/makernote-test.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Mark Purcell
  • Date: 2008-06-21 08:23:53 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20080621082353-b1n4w08trwfwbfl4
Tags: 0.17.1-1
* New upstream release
  - Library transition cleared on debian-release/ d-d-a
* Version 0.17 also fixes:
  - CVE-2008-2696: DoS via metadata in images (Closes: #486328)
  - crashes when fed with wrong file (Closes: #485670)
* Urgency medium for CVE fix
* debian/patches/gcc4.3.diff unecessary for gcc-4.3
* Add /usr/share/bug/exiv2/presubj message for reportbug(1)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#include "makernote.hpp"
2
 
 
3
 
#include <iostream>
4
 
#include <string>
5
 
#include <utility>
6
 
 
7
 
void testMatch(const std::string& reg, const std::string& key);
8
 
 
9
 
int main()
10
 
{
11
 
    testMatch("Canon", "Canon");
12
 
    testMatch("Canon*", "Canon");
13
 
    testMatch("Canon*", "Canon Corp.");
14
 
    testMatch("*foo*bar*", "foobar");
15
 
    testMatch("*foo*bar*", "barfoofoobarbar");
16
 
    testMatch("foo*bar", "foo");
17
 
    testMatch("foo*bar", "bar");
18
 
    testMatch("foo*bar", "foobar");
19
 
    testMatch("foo*bar", "fooYAHOObar");
20
 
    testMatch("foo*bar", "Thefoobar");
21
 
    testMatch("foo*bar", "foobarTrick");
22
 
    testMatch("foo*bar", "ThefoobarTrick");
23
 
    testMatch("foo*bar", "ThefooYAHOObarTrick");
24
 
 
25
 
    testMatch("*", "anything");
26
 
    testMatch("**", "anything times two");
27
 
 
28
 
    testMatch("*bar", "bar");
29
 
    testMatch("b*bar", "bar");
30
 
    testMatch("b*bar", "bbar");
31
 
    testMatch("*foobar", "bar");
32
 
    testMatch("*bar", "foobar");
33
 
 
34
 
    return 0;
35
 
}
36
 
 
37
 
void testMatch(const std::string& reg, const std::string& key)
38
 
{
39
 
    int rc = Exiv2::MakerNoteFactory::match(reg, key);
40
 
 
41
 
    if (rc) {
42
 
        std::cout << "Key '" << key << "' matches '" << reg << "' "
43
 
                  << "with a score of " << rc << ".\n";
44
 
    }
45
 
    else {
46
 
        std::cout << "Key '" << key << "' does not match '" << reg << "'.\n";
47
 
    }
48
 
}