5
Last change
on this file since b055da27 was
b055da27,
checked in by Himanshu40 <himanshuwindows8.1@…>, on 12/03/18 at 17:04:04
|
psxhdrs: add POSIX API Signature Compliance Tests for regex.h (GCI 2018)
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * @brief regerror() API Conformance Test |
---|
4 | */ |
---|
5 | |
---|
6 | /* |
---|
7 | * COPYRIGHT (c) 2018. |
---|
8 | * Himanshu Sekhar Nayak |
---|
9 | * |
---|
10 | * Permission to use, copy, modify, and/or distribute this software |
---|
11 | * for any purpose with or without fee is hereby granted. |
---|
12 | * |
---|
13 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL |
---|
14 | * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED |
---|
15 | * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR |
---|
16 | * BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES |
---|
17 | * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, |
---|
18 | * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, |
---|
19 | * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
---|
20 | */ |
---|
21 | |
---|
22 | #ifdef HAVE_CONFIG_H |
---|
23 | #include "config.h" |
---|
24 | #endif |
---|
25 | |
---|
26 | #include <sys/types.h> |
---|
27 | #include <regex.h> |
---|
28 | |
---|
29 | int test( void ); |
---|
30 | |
---|
31 | int test( void ) |
---|
32 | { |
---|
33 | regex_t preg; |
---|
34 | size_t error; |
---|
35 | char *regex = "\\(sim[a-z]le\\) \\1"; |
---|
36 | char buffer[100]; |
---|
37 | int result; |
---|
38 | |
---|
39 | result = regcomp( &preg, regex, REG_EXTENDED|REG_NOSUB ); |
---|
40 | (void) result; |
---|
41 | error = regerror( result, &preg, buffer, 100 ); |
---|
42 | |
---|
43 | return (error != '\0'); |
---|
44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.