summaryrefslogtreecommitdiff
path: root/xc/test/xsuite/xtest/tset/CH10/rmqrktstr/rmqrktstr.m
blob: a557cacfdda6b22f1104554a6d4e8178d559479d (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/*
 * Copyright 1990, 1991 by the Massachusetts Institute of Technology and
 * UniSoft Group Limited.
 * 
 * Permission to use, copy, modify, distribute, and sell this software and
 * its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and that
 * both that copyright notice and this permission notice appear in
 * supporting documentation, and that the names of MIT and UniSoft not be
 * used in advertising or publicity pertaining to distribution of the
 * software without specific, written prior permission.  MIT and UniSoft
 * make no representations about the suitability of this software for any
 * purpose.  It is provided "as is" without express or implied warranty.
 *
 * $XConsortium$
 */
>>TITLE XrmQuarkToString CH10
char *

XrmQuark quark;
>>SET startup rmstartup
>>ASSERTION Good A
A call to xname returns a pointer to the string that corresponds to
the
.A quark .
>>STRATEGY
Call XrmStringToQuark to allocate a quark for a string.
Call xname to obtain the representation for the quark.
>>CODE
char *s="qts_one";
char *ret;

/* Call XrmStringToQuark to allocate a quark for a string. */
	quark = XrmStringToQuark( s );

/* Call xname to obtain the representation for the quark. */
	ret = XCALL;

	if (ret==(char *)NULL || strcmp(s,ret)) {
		FAIL;
		report("%s did not return the representation for the quark.",
			TestName);
		report("Expected representation: %s", s);
		report("Returned representation: %s",
			(ret==(char *)NULL?"NULL pointer":ret));
	} else
		CHECK;

	CHECKPASS(1);

>>ASSERTION Good A
When no string exists for a
.A quark ,
then a call to xname returns
.S NULL .
>>STRATEGY
Create a unique quark which has no string representation.
Call xname to obtain the representation for the quark.
Verify that a NULL pointer was returned.
>>CODE
char *ret;

/* Create a unique quark which has no string representation. */
	quark = XrmUniqueQuark();

/* Call xname to obtain the representation for the quark. */
	ret = XCALL;

/* Verify that a NULL pointer was returned. */
	if (ret != (char *)NULL) {
		FAIL;
		report("%s returned unexpected value with a quark with",
			TestName);
		report("no string representation.");
		report("Expected value: NULL pointer");
		report("Returned value: '%s'", ret);
	} else
		CHECK;

	CHECKPASS(1);