~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to lib/libTrie/test/trie-c.c

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2006-11-11 10:32:06 UTC
  • Revision ID: james.westby@ubuntu.com-20061111103206-f3p0r9g0vq44rp3r
Tags: upstream-3.0.PRE5
ImportĀ upstreamĀ versionĀ 3.0.PRE5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2002 Robert Collins <rbtcollins@hotmail.com>
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU General Public License as published by
 
6
 * the Free Software Foundation; either version 2 of the License, or
 
7
 * (at your option) any later version.
 
8
 * 
 
9
 * This program 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
 
12
 * GNU General Public License for more details.
 
13
 * 
 
14
 * You should have received a copy of the GNU General Public License
 
15
 * along with this program; if not, write to the Free Software
 
16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
 
17
 *
 
18
 */
 
19
 
 
20
#include "Trie.h"
 
21
#include <stdio.h>
 
22
 
 
23
int
 
24
main (int argc, char **argv)
 
25
{
 
26
    void *aTrie = TrieCreate();
 
27
    if (!TrieAdd (aTrie, "User-Agent", 10, (void *)1)) {
 
28
        fprintf(stderr,"Could not add User-Agent\n");
 
29
        return 1;
 
30
    }
 
31
    if (TrieAdd (aTrie, "User-Agent", 10, (void *)2)) {
 
32
        fprintf(stderr, "Could add duplicate User-Agent\n");
 
33
        return 1;
 
34
    }
 
35
    if (TrieFind (aTrie, "User-Agent", 10) != (void *)1) {
 
36
        fprintf(stderr, "Could not find User-Agent\n");
 
37
        return 1;
 
38
    }
 
39
    TrieDestroy (aTrie);
 
40
    return 0;
 
41
}