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