static void test_all_spy_message(CuTest *tc) { spy_fixture fix; setup_spy(&fix); enable_skill(SK_MAGIC, true); set_level(fix.victim, SK_MINING, 2); set_level(fix.victim, SK_MAGIC, 2); create_mage(fix.victim, M_DRAIG); set_factionstealth(fix.victim, fix.spy->faction); item_type *itype; itype = it_get_or_create(rt_get_or_create("sword")); new_weapontype(itype, 0, 0.0, NULL, 0, 0, 0, SK_MELEE, 2); i_change(&fix.victim->items, itype, 1); spy_message(99, fix.spy, fix.victim); CuAssertPtrNotNull(tc, test_find_messagetype(fix.spy->faction->msgs, "spyreport")); CuAssertPtrNotNull(tc, test_find_messagetype(fix.spy->faction->msgs, "spyreport_mage")); CuAssertPtrNotNull(tc, test_find_messagetype(fix.spy->faction->msgs, "spyreport_skills")); CuAssertPtrNotNull(tc, test_find_messagetype(fix.spy->faction->msgs, "spyreport_faction")); CuAssertPtrNotNull(tc, test_find_messagetype(fix.spy->faction->msgs, "spyreport_items")); test_cleanup(); }
static void test_simple_spy_message(CuTest *tc) { spy_fixture fix; setup_spy(&fix); spy_message(0, fix.spy, fix.victim); CuAssertPtrNotNull(tc, test_find_messagetype(fix.spy->faction->msgs, "spyreport")); test_cleanup(); }
int main(int argc, char *argv[]) { char buf[512]; DEFINE_SEQFILE(m, buf, sizeof(buf)); if (argc < 2) { fatal("usage: %s <message>\n", argv[0]); } spy_message(&m, argv[1]); spy_send(&m); return 0; }