예제 #1
0
/*
 * Add n random maps x
 */
static void random_tests(pseudo_subst_t *subst, uint32_t n) {
  term_t x;

  while (n > 0) {
    x = random() % 100;
    test_var(subst, x);
    n --;
  }
}
예제 #2
0
int
main (int argc, char **argv)
{
  kpse_set_program_name(argv[0], NULL);
  test_var ("a", "a");
  test_var ("$foo", "");
  test_var ("a$foo", "a");
  test_var ("$foo a", " a");
  test_var ("a$foo b", "a b");

  xputenv ("FOO", "foo value");
  test_var ("a$FOO", "afoo value");

  xputenv ("Dollar", "$");
  test_var ("$Dollar a", "$ a");

  test_var ("a${FOO}b", "afoo valueb");
  test_var ("a${}b", "ab");

  test_var ("$$", ""); /* and error */
  test_var ("a${oops", "a"); /* and error */

  return 0;
}