File: epath_pattern_079.c

package info (click to toggle)
openhpi 2.12.0-1
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 18,580 kB
  • ctags: 13,105
  • sloc: ansic: 177,276; cpp: 31,164; sh: 9,315; makefile: 4,463; perl: 1,529
file content (52 lines) | stat: -rw-r--r-- 1,725 bytes parent folder | download | duplicates (8)
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
48
49
50
51
52
/* -*- linux-c -*-
 *
 * (C) Copyright IBM Corp. 2005
 *
 * This program 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.  This
 * file and program are licensed under a BSD style license.  See
 * the Copying file included with the OpenHPI distribution for
 * full licensing terms.
 *
 * Author: Renier Morales <renier@openhpi.org>
 */

#include <SaHpi.h>
#include <oh_utils.h>

/*******************************************************************
 * WARNING! This file is auto-magically generated by:
 *          ./gen_epath_pattern_tests.py
 *          Do not change this file manually. Update script instead
 *******************************************************************/

/**
 * This takes an entity path and an entity path's pattern,
 * and knowing the proper result beforehand, checks if the
 * pattern matches the entity path. If the proper result is
 * achieved, the test passes.
 **/
int main(int argc, char **argv)
{

        char *ep_str = "{SYSTEM_CHASSIS,1}{PHYSICAL_SLOT,3}{SBC_BLADE,3}{ADD_IN_CARD,8}";
        char *epp_str = "{SYSTEM_CHASSIS,1}{.,.}*";
        oh_entitypath_pattern epp;
        SaHpiEntityPathT ep;
        SaErrorT error = SA_OK;
        SaHpiBoolT match = SAHPI_TRUE;

        error = oh_encode_entitypath(ep_str, &ep);
        if (error) { printf("Encoding of entitypath failed.\n"); return -1; }

        error = oh_compile_entitypath_pattern(epp_str, &epp);
        if (error) { printf("Compilation of pattern failed.\n"); return -1; }

        if (oh_match_entitypath_pattern(&epp, &ep) != match)
                return -1;
        

        return 0;
}