Atrinik Server 2.5
tests/bugs/check_85.c
Go to the documentation of this file.
00001 /************************************************************************
00002 *            Atrinik, a Multiplayer Online Role Playing Game            *
00003 *                                                                       *
00004 *    Copyright (C) 2009-2011 Alex Tokar and Atrinik Development Team    *
00005 *                                                                       *
00006 * Fork from Daimonin (Massive Multiplayer Online Role Playing Game)     *
00007 * and Crossfire (Multiplayer game for X-windows).                       *
00008 *                                                                       *
00009 * This program is free software; you can redistribute it and/or modify  *
00010 * it under the terms of the GNU General Public License as published by  *
00011 * the Free Software Foundation; either version 2 of the License, or     *
00012 * (at your option) any later version.                                   *
00013 *                                                                       *
00014 * This program is distributed in the hope that it will be useful,       *
00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00017 * GNU General Public License for more details.                          *
00018 *                                                                       *
00019 * You should have received a copy of the GNU General Public License     *
00020 * along with this program; if not, write to the Free Software           *
00021 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.             *
00022 *                                                                       *
00023 * The author can be reached at admin@atrinik.org                        *
00024 ************************************************************************/
00025 
00032 #include <global.h>
00033 #include <check_proto.h>
00034 #include <check.h>
00035 
00036 START_TEST(test_run)
00037 {
00038     int i;
00039     treasurelist *list;
00040     object *tmp;
00041 
00042     list = find_treasurelist("random_talisman");
00043 
00044     fail_if(list == NULL, "Couldn't find 'random_talisman' treasure list to start the test.");
00045 
00046     for (i = 0; i < 2000; i++)
00047     {
00048         tmp = generate_treasure(list, MAXLEVEL, list->artifact_chance);
00049 
00050         if (tmp && !strcmp(tmp->artifact, "amulet_shielding"))
00051         {
00052             if (QUERY_FLAG(tmp, FLAG_CURSED) || QUERY_FLAG(tmp, FLAG_DAMNED))
00053             {
00054                 fail("Managed to create cursed amulet of minor shielding (i: %d).", i);
00055             }
00056         }
00057     }
00058 }
00059 END_TEST
00060 
00061 static Suite *bug_suite()
00062 {
00063     Suite *s = suite_create("bug");
00064     TCase *tc_core = tcase_create("Core");
00065 
00066     tcase_add_checked_fixture(tc_core, NULL, NULL);
00067 
00068     suite_add_tcase(s, tc_core);
00069     tcase_add_test(tc_core, test_run);
00070 
00071     return s;
00072 }
00073 
00074 void check_bug_85()
00075 {
00076     Suite *s = bug_suite();
00077     SRunner *sr = srunner_create(s);
00078 
00079     srunner_set_xml(sr, "unit/bugs/85.xml");
00080     srunner_set_log(sr, "unit/bugs/85.out");
00081     srunner_run_all(sr, CK_ENV);
00082     srunner_ntests_failed(sr);
00083     srunner_free(sr);
00084 }