summaryrefslogtreecommitdiff
path: root/tests/libtracker-data/tracker-crc32-test.c
blob: 6a2648063bd313950916e96ac035080d8bda131e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
 * Copyright (C) 2011, Nokia <ivan.frade@nokia.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA  02110-1301, USA.
 */

#include "config.h"

#include <glib-object.h>

#include <libtracker-data/tracker-crc32.h>

// Using http://crc32-checksum.waraxe.us/ to check the result
static void
test_crc32_calculate ()
{
        guint32 result;
        guint32 expected = 0x81F8B2A3;

        result = tracker_crc32 ("Who is Meego? Meego is dead, baby. Meego is dead", 48);
        
        g_assert_cmpint (expected, ==, result);
}

gint
main (gint argc, gchar **argv)
{
        g_test_init (&argc, &argv, NULL);

        g_test_add_func ("/libtracker-common/crc32/calculate",
                         test_crc32_calculate);

        return g_test_run ();
}