tracker-0.16.2/tests/libtracker-common/tracker-crc32-test.c

No issues found

 1 /*
 2  * Copyright (C) 2011, Nokia <ivan.frade@nokia.com>
 3  *
 4  * This library is free software; you can redistribute it and/or
 5  * modify it under the terms of the GNU General Public
 6  * License as published by the Free Software Foundation; either
 7  * version 2 of the License, or (at your option) any later version.
 8  *
 9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA  02110-1301, USA.
18  */
19 #include <glib.h>
20 #include <glib-object.h>
21 
22 #include <libtracker-common/tracker-crc32.h>
23 
24 // Using http://crc32-checksum.waraxe.us/ to check the result
25 static void
26 test_crc32_calculate ()
27 {
28         guint32 result;
29         guint32 expected = 0x81F8B2A3;
30 
31         result = tracker_crc32 ("Who is Meego? Meego is dead, baby. Meego is dead", 48);
32         
33         g_assert_cmpint (expected, ==, result);
34 }
35 
36 gint
37 main (gint argc, gchar **argv)
38 {
39         g_test_init (&argc, &argv, NULL);
40 
41         g_test_add_func ("/libtracker-common/crc32/calculate",
42                          test_crc32_calculate);
43 
44         return g_test_run ();
45 }