コード例 #1
0
        public static void test_names()
        {
            Object.Artifact a = new Object.Artifact();
            string          n;

            a.aidx = 1;
            for (int i = 0; i < NAMES_TRIES; i++)
            {
                n = a.gen_name(p);
                if (n.Contains('\''))
                {
                    if (n.IndexOf('\'') == n.LastIndexOf('\''))
                    {
                        Fail("A ' was opened and never closed");
                    }
                }
                else
                {
                    if (!n.Contains("of "))
                    {
                        Fail("The unique name did not contain 'of' or any single quotes");
                    }
                }
            }

            Ok();
        }
コード例 #2
0
 public static Object.Artifact Artifact_Sword()
 {
     Object.Artifact a = new Object.Artifact();
     a.Name   = "Test Artifact";
     a.Text   = "A test artifact.";
     a.aidx   = 0;
     a.Next   = null;
     a.tval   = Object.TVal.TV_SWORD;
     a.sval   = (int)Object.SVal.sval_sword.SV_LONG_SWORD;
     a.to_a   = 1;
     a.to_h   = 2;
     a.to_d   = 3;
     a.ac     = 5;
     a.dd     = 2;
     a.ds     = 5;
     a.weight = 16;
     a.cost   = 40;
     return(a);
 }
コード例 #3
0
ファイル: Randname_Test.cs プロジェクト: jobjingjo/csangband
        public static void test_names()
        {
            Object.Artifact a = new Object.Artifact();
            string n;

            a.aidx = 1;
            for (int i = 0; i < NAMES_TRIES; i++) {
                n = a.gen_name(p);
                if(n.Contains('\'')) {
                    if(n.IndexOf('\'') == n.LastIndexOf('\'')) {
                        Fail("A ' was opened and never closed");
                    }
                } else {
                    if(!n.Contains("of ")) {
                        Fail("The unique name did not contain 'of' or any single quotes");
                    }
                }
            }

            Ok();
        }