MCPcopy Index your code
hub / github.com/F-Stack/f-stack / main

Function main

tools/libutil/tests/grp_test.c:66–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65
66int
67main(void)
68{
69 char *strGrp;
70 int testNdx;
71 struct group *dupGrp;
72 struct group *scanGrp;
73 struct group origGrp;
74
75 /* Setup. */
76 printf("1..4\n");
77 testNdx = 0;
78
79 /* Manually build a group using static values. */
80 build_grp(&origGrp);
81
82 /* Copy the group. */
83 testNdx++;
84 if ((dupGrp = gr_dup(&origGrp)) == NULL)
85 printf("not ");
86 printf("ok %d - %s\n", testNdx, "gr_dup");
87
88 /* Compare the original and duplicate groups. */
89 testNdx++;
90 if (! gr_equal(&origGrp, dupGrp))
91 printf("not ");
92 printf("ok %d - %s\n", testNdx, "gr_equal");
93
94 /* Create group string from the duplicate group structure. */
95 testNdx++;
96 strGrp = gr_make(dupGrp);
97 if (strcmp(strGrp, origStrGrp) != 0)
98 printf("not ");
99 printf("ok %d - %s\n", testNdx, "gr_make");
100
101 /*
102 * Create group structure from string and compare it to the original
103 * group structure.
104 */
105 testNdx++;
106 if ((scanGrp = gr_scan(strGrp)) == NULL || ! gr_equal(&origGrp,
107 scanGrp))
108 printf("not ");
109 printf("ok %d - %s\n", testNdx, "gr_scan");
110
111 /* Clean up. */
112 free(scanGrp);
113 free(strGrp);
114 free(dupGrp);
115
116 exit(EXIT_SUCCESS);
117}

Callers

nothing calls this directly

Calls 8

build_grpFunction · 0.85
gr_dupFunction · 0.85
gr_equalFunction · 0.85
gr_makeFunction · 0.85
strcmpFunction · 0.85
gr_scanFunction · 0.85
printfFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected