コード例 #1
0
        public void Test1()
        {
            HeaderCard p;

            p = new HeaderCard("SIMPLE  =                     T");

            Assertion.AssertEquals("t1", "SIMPLE", p.Key);
            Assertion.AssertEquals("t2", "T", p.Value);
            Assertion.AssertNull("t3", p.Comment);

            p = new HeaderCard("VALUE   =                   123");
            Assertion.AssertEquals("t4", "VALUE", p.Key);
            Assertion.AssertEquals("t5", "123", p.Value);
            Assertion.AssertNull("t3", p.Comment);

            p = new HeaderCard("VALUE   =    1.23698789798798E23 / Comment ");
            Assertion.AssertEquals("t6", "VALUE", p.Key);
            Assertion.AssertEquals("t7", "1.23698789798798E23", p.Value);
            Assertion.AssertEquals("t8", "Comment", p.Comment);

            String lng = "111111111111111111111111111111111111111111111111111111111111111111111111";

            p = new HeaderCard("COMMENT " + lng);
            Assertion.AssertEquals("t9", "COMMENT", p.Key);
            Assertion.AssertNull("t10", p.Value);
            Assertion.AssertEquals("t11", lng, p.Comment);

            bool thrown = false;

            try
            {
                //
                p = new HeaderCard("VALUE   = '   ");
            }
            catch (Exception)
            {
                thrown = true;
            }
            Assertion.AssertEquals("t12", true, thrown);


            p = new HeaderCard("COMMENT " + lng + lng);
            Assertion.AssertEquals("t13", lng, p.Comment);
        }
コード例 #2
0
        public void TestHierarch()
        {
            HeaderCard hc;
            String     key    = "HIERARCH.TEST1.TEST2.INT";
            bool       thrown = false;

            try
            {
                hc = new HeaderCard(key, 123, "Comment");
            }
            catch (Exception)
            {
                thrown = true;
            }
            Assertion.AssertEquals("h1", true, thrown);

            String card = "HIERARCH TEST1 TEST2 INT=           123 / Comment                               ";

            hc = new HeaderCard(card);
            Assertion.AssertEquals("h2", "HIERARCH", hc.Key);
            Assertion.AssertNull("h3", hc.Value);
            Assertion.AssertEquals("h4", "TEST1 TEST2 INT=           123 / Comment", hc.Comment);

            FitsFactory.UseHierarch = true;


            hc = new HeaderCard(key, 123, "Comment");

            Assertion.AssertEquals("h5", key, hc.Key);
            Assertion.AssertEquals("h6", "123", hc.Value);
            Assertion.AssertEquals("h7", "Comment", hc.Comment);

            hc = new HeaderCard(card);
            Assertion.AssertEquals("h8", key, hc.Key);
            Assertion.AssertEquals("h9", "123", hc.Value);
            Assertion.AssertEquals("h10", "Comment", hc.Comment);
        }