コード例 #1
0
        static void Test_Clear()
        {
            SplitArray <char> chars = new SplitArray <char>(5, 8);

            chars.Clear();
            TestUtl.AssertEquals(0, chars.Count);
            for (int x = 0; x < 10; x++)
            {
                try{ chars.GetAt(x); Debug.Fail("exception must be thrown here."); }
                catch (Exception ex) { TestUtl.AssertType <AssertException>(ex); }
                try{ chars.SetAt('!', x); Debug.Fail("exception must be thrown here."); }
                catch (Exception ex) { TestUtl.AssertType <AssertException>(ex); }
            }

            chars.Add("hoge".ToCharArray());
            chars.Clear();
            TestUtl.AssertEquals(0, chars.Count);
            for (int x = 0; x < 10; x++)
            {
                try{ chars.GetAt(x); Debug.Fail("exception must be thrown here."); }
                catch (Exception ex) { TestUtl.AssertType <AssertException>(ex); }
                try{ chars.SetAt('!', x); Debug.Fail("exception must be thrown here."); }
                catch (Exception ex) { TestUtl.AssertType <AssertException>(ex); }
            }
        }
コード例 #2
0
        public void Clear()
        {
            SplitArray <char> chars = new SplitArray <char>(5, 8);

            chars.Clear();
            Assert.AreEqual(0, chars.Count);
            for (int x = 0; x < 10; x++)
            {
                MyAssert.Throws <AssertException>(delegate {
                    chars.GetAt(x);
                });
                MyAssert.Throws <AssertException>(delegate {
                    chars.SetAt('!', x);
                });
            }

            chars.Add("hoge".ToCharArray());
            chars.Clear();
            Assert.AreEqual(0, chars.Count);
            for (int x = 0; x < 10; x++)
            {
                MyAssert.Throws <AssertException>(delegate {
                    chars.GetAt(x);
                });
                MyAssert.Throws <AssertException>(delegate {
                    chars.SetAt('!', x);
                });
            }
        }
コード例 #3
0
        static void Test_Add()
        {
            SplitArray <char> chars = new SplitArray <char>(5, 8);

            chars.Add('a');
            TestUtl.AssertEquals(1, chars.Count);
            TestUtl.AssertEquals('a', chars.GetAt(0));
            chars.SetAt('b', 0);
            TestUtl.AssertEquals('b', chars.GetAt(0));
            try{ chars.GetAt(1); Debug.Fail("exception must be thrown here."); }
            catch (Exception ex) { TestUtl.AssertType <AssertException>(ex); }
        }
コード例 #4
0
        static void Test_Init()
        {
            SplitArray <char> chars = new SplitArray <char>(5, 8);

            TestUtl.AssertEquals(0, chars.Count);
            for (int x = 0; x < 10; x++)
            {
                try{ chars.GetAt(x); Debug.Fail("exception must be thrown here. (index:" + x + ")"); }
                catch (Exception ex) { TestUtl.AssertType <AssertException>(ex); }
                try{ chars.SetAt('!', x); Debug.Fail("exception must be thrown here. (index:" + x + ")"); }
                catch (Exception ex) { TestUtl.AssertType <AssertException>(ex); }
            }
        }
コード例 #5
0
        public void Add()
        {
            SplitArray <char> chars = new SplitArray <char>(5, 8);

            chars.Add('a');
            Assert.AreEqual(1, chars.Count);
            Assert.AreEqual('a', chars.GetAt(0));
            chars.SetAt('b', 0);
            Assert.AreEqual('b', chars.GetAt(0));
            MyAssert.Throws <AssertException>(delegate {
                chars.GetAt(1);
            });
        }
コード例 #6
0
        public void Init()
        {
            SplitArray <char> chars = new SplitArray <char>(5, 8);

            Assert.AreEqual(0, chars.Count);
            for (int x = 0; x < 10; x++)
            {
                MyAssert.Throws <AssertException>(delegate {
                    chars.GetAt(x);
                });
                MyAssert.Throws <AssertException>(delegate {
                    chars.SetAt('!', x);
                });
            }
        }