/* Test ## behaviour and corner cases thoroughly. The macro expander
failed many of these during development. */
-#include <string.h>
-
#ifndef __WCHAR_TYPE__
#define __WCHAR_TYPE__ int
#endif
typedef __WCHAR_TYPE__ wchar_t;
+extern int strcmp (const char *, const char *);
extern int puts (const char *);
extern void abort (void);
#define err(str) do { puts(str); abort(); } while (0)
err ("Operator >> pasting");
/* The LHS should not attempt to expand twice, and thus becomes a
- call to the function glue, but the RHS should fully expand. */
- if (glue (gl, ue) (12) != glue (xgl, ue) (1, 2))
+ call to the function glue. */
+ if (glue (gl, ue) (12) != 12)
err ("Recursive macros");
/* Test placemarker pasting. The glued lines should all appear
err ("Various operator pasting");
if (strcmp (hh, "%:%:"))
err ("Pasted digraph spelling");
- if ((glue (., 0) glue (=, =) .0) + (glue3 (1.0e, +, 1) == 10.0) != 2)
- err ("Pasted numbers");
+ if ((glue (., 1) glue (!, =) .1))
+ err ("Pasted numbers 1");
+ /* glue3 here will only work if we paste left-to-right. If a
+ future implementation does not do this, change the test. */
+ if (glue3 (1.0e, +, 1) != 10.0)
+ err ("Pasted numbers 2");
}
return 0;