15using namespace Magick;
17int test( CoderInfo::MatchType isReadable_,
18 CoderInfo::MatchType isWritable_,
19 CoderInfo::MatchType isMultiFrame_ )
22 list<CoderInfo> coderList;
23 coderInfoList( &coderList, isReadable_, isWritable_, isMultiFrame_ );
24 list<CoderInfo>::iterator entry = coderList.begin();
25 while( entry != coderList.end() )
28 if ( isReadable_ != CoderInfo::AnyMatch &&
29 (( entry->isReadable() && isReadable_ != CoderInfo::TrueMatch ) ||
30 ( !entry->isReadable() && isReadable_ != CoderInfo::FalseMatch )) )
34 <<
"\" has unexpected readability state ("
35 <<
static_cast<int>(entry->isReadable())
42 if ( isWritable_ != CoderInfo::AnyMatch &&
43 (( entry->isWritable() && isWritable_ != CoderInfo::TrueMatch ) ||
44 ( !entry->isWritable() && isWritable_ != CoderInfo::FalseMatch )) )
48 <<
"\" has unexpected writability state ("
49 <<
static_cast<int>(entry->isWritable())
56 if ( isMultiFrame_ != CoderInfo::AnyMatch &&
57 (( entry->isMultiFrame() && isMultiFrame_ != CoderInfo::TrueMatch ) ||
58 ( !entry->isMultiFrame() && isMultiFrame_ != CoderInfo::FalseMatch )) )
62 <<
"\" has unexpected multiframe state ("
63 <<
static_cast<int>(entry->isMultiFrame())
75int main(
int ,
char **argv)
79 InitializeMagick(*argv);
86 if ( coderInfo.name() !=
string(
"GIF") )
88 cout <<
"Unexpected coder name \""
95 if( coderInfo.description() !=
string(
"CompuServe graphics interchange format") )
97 cout <<
"Unexpected coder description \""
98 << coderInfo.description()
104 failures += test(CoderInfo::AnyMatch,CoderInfo::AnyMatch,CoderInfo::AnyMatch);
105 failures += test(CoderInfo::FalseMatch,CoderInfo::FalseMatch,CoderInfo::FalseMatch);
107 failures += test(CoderInfo::TrueMatch,CoderInfo::AnyMatch,CoderInfo::AnyMatch);
108 failures += test(CoderInfo::FalseMatch,CoderInfo::AnyMatch,CoderInfo::AnyMatch);
110 failures += test(CoderInfo::AnyMatch,CoderInfo::TrueMatch,CoderInfo::AnyMatch);
111 failures += test(CoderInfo::AnyMatch,CoderInfo::FalseMatch,CoderInfo::AnyMatch);
113 failures += test(CoderInfo::AnyMatch,CoderInfo::AnyMatch,CoderInfo::TrueMatch);
114 failures += test(CoderInfo::AnyMatch,CoderInfo::AnyMatch,CoderInfo::FalseMatch);
118 cout <<
"Caught exception: " << error_.what() << endl;
121 catch( exception &error_ )
123 cout <<
"Caught exception: " << error_.what() << endl;
129 cout << failures <<
" failures" << endl;