1*735d6239SKiyoung Kim /* test-sorted.c
2*735d6239SKiyoung Kim *
3*735d6239SKiyoung Kim * This test ensures that the ExifTagTable[] array is stored in sorted
4*735d6239SKiyoung Kim * order. If that were not so, then it a binary search of the array would
5*735d6239SKiyoung Kim * not give correct results.
6*735d6239SKiyoung Kim *
7*735d6239SKiyoung Kim * Copyright 2009 Dan Fandrich <[email protected]>
8*735d6239SKiyoung Kim *
9*735d6239SKiyoung Kim * This library is free software; you can redistribute it and/or
10*735d6239SKiyoung Kim * modify it under the terms of the GNU Lesser General Public
11*735d6239SKiyoung Kim * License as published by the Free Software Foundation; either
12*735d6239SKiyoung Kim * version 2 of the License, or (at your option) any later version.
13*735d6239SKiyoung Kim *
14*735d6239SKiyoung Kim * This library is distributed in the hope that it will be useful,
15*735d6239SKiyoung Kim * but WITHOUT ANY WARRANTY; without even the implied warranty of
16*735d6239SKiyoung Kim * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17*735d6239SKiyoung Kim * Lesser General Public License for more details.
18*735d6239SKiyoung Kim *
19*735d6239SKiyoung Kim * You should have received a copy of the GNU Lesser General Public
20*735d6239SKiyoung Kim * License along with this library; if not, write to the
21*735d6239SKiyoung Kim * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
22*735d6239SKiyoung Kim * Boston, MA 02110-1301 USA
23*735d6239SKiyoung Kim */
24*735d6239SKiyoung Kim
25*735d6239SKiyoung Kim #include <libexif/exif-tag.h>
26*735d6239SKiyoung Kim #include <stdio.h>
27*735d6239SKiyoung Kim
28*735d6239SKiyoung Kim int
main(void)29*735d6239SKiyoung Kim main (void)
30*735d6239SKiyoung Kim {
31*735d6239SKiyoung Kim int rc = 0;
32*735d6239SKiyoung Kim unsigned int i, num;
33*735d6239SKiyoung Kim ExifTag last = 0, current;
34*735d6239SKiyoung Kim num = exif_tag_table_count() - 1; /* last entry is a NULL terminator */
35*735d6239SKiyoung Kim for (i=0; i < num; ++i) {
36*735d6239SKiyoung Kim current = exif_tag_table_get_tag(i);
37*735d6239SKiyoung Kim if (current < last) {
38*735d6239SKiyoung Kim printf("Tag 0x%04x in ExifTagTable[] is out of order\n",
39*735d6239SKiyoung Kim current);
40*735d6239SKiyoung Kim rc = 1;
41*735d6239SKiyoung Kim }
42*735d6239SKiyoung Kim if (exif_tag_table_get_name(i) == NULL) {
43*735d6239SKiyoung Kim printf("Tag 0x%04x has a NULL name\n", current);
44*735d6239SKiyoung Kim rc = 1;
45*735d6239SKiyoung Kim }
46*735d6239SKiyoung Kim last = current;
47*735d6239SKiyoung Kim }
48*735d6239SKiyoung Kim
49*735d6239SKiyoung Kim return rc;
50*735d6239SKiyoung Kim }
51