Changeset 21dc927


Ignore:
Timestamp:
Dec 2, 2013, 3:56:28 AM (4 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master
Children:
ebcdf4d
Parents:
ebc6f77
git-author:
Anders Kaseorg <andersk@mit.edu> (11/10/13 22:35:36)
git-committer:
Anders Kaseorg <andersk@mit.edu> (12/02/13 03:56:28)
Message:
Test owl_zephyr_smartstripped_user

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • tester.c

    r6a8b519 r21dc927  
    2525int owl_history_regtest(void);
    2626int call_filter_regtest(void);
     27int owl_smartstrip_regtest(void);
    2728
    2829extern void owl_perl_xs_init(pTHX);
     
    116117  numfailures += owl_history_regtest();
    117118  numfailures += call_filter_regtest();
     119  numfailures += owl_smartstrip_regtest();
    118120  if (numfailures) {
    119121      fprintf(stderr, "# *** WARNING: %d failures total\n", numfailures);
     
    10181020  return numfailed;
    10191021}
     1022
     1023int owl_smartstrip_regtest(void)
     1024{
     1025  int numfailed = 0;
     1026
     1027  printf("# BEGIN testing owl_zephyr_smartstripped_user\n");
     1028
     1029#define CHECK_SMARTSTRIP(in, expected)                  \
     1030  do {                                                  \
     1031    char *__value = owl_zephyr_smartstripped_user(in);  \
     1032    FAIL_UNLESS("owl_zephyr_smartstripped_user " in,    \
     1033                strcmp((expected), __value) == 0);      \
     1034    g_free(__value);                                    \
     1035  } while (0)
     1036
     1037  CHECK_SMARTSTRIP("foo", "foo");
     1038  CHECK_SMARTSTRIP("foo.bar", "foo");
     1039  CHECK_SMARTSTRIP("foo/bar", "foo");
     1040  CHECK_SMARTSTRIP("host/bar", "host/bar");
     1041  CHECK_SMARTSTRIP("rcmd.bar", "rcmd.bar");
     1042  CHECK_SMARTSTRIP("daemon/bar", "daemon/bar");
     1043  CHECK_SMARTSTRIP("daemon.bar", "daemon.bar");
     1044
     1045  CHECK_SMARTSTRIP("foo@ATHENA.MIT.EDU", "foo@ATHENA.MIT.EDU");
     1046  CHECK_SMARTSTRIP("foo.bar@ATHENA.MIT.EDU", "foo@ATHENA.MIT.EDU");
     1047  CHECK_SMARTSTRIP("foo/bar@ATHENA.MIT.EDU", "foo@ATHENA.MIT.EDU");
     1048  CHECK_SMARTSTRIP("host/bar@ATHENA.MIT.EDU", "host/bar@ATHENA.MIT.EDU");
     1049  CHECK_SMARTSTRIP("rcmd.bar@ATHENA.MIT.EDU", "rcmd.bar@ATHENA.MIT.EDU");
     1050  CHECK_SMARTSTRIP("daemon/bar@ATHENA.MIT.EDU", "daemon/bar@ATHENA.MIT.EDU");
     1051  CHECK_SMARTSTRIP("daemon.bar@ATHENA.MIT.EDU", "daemon.bar@ATHENA.MIT.EDU");
     1052
     1053  printf("# END testing owl_zephyr_smartstripped_user\n");
     1054
     1055  return numfailed;
     1056}
Note: See TracChangeset for help on using the changeset viewer.