コード例 #1
0
        public void minusTest()
        {
            Collections.Set<int> s = new Collections.Set<int>();
            Collections.Set<int> s2 = new Collections.Set<int>();
            int[] a = { 1, 5, 6, 9 };
            int[] b = { 1, 4, 7, 9 };

            for (int i = 0; i < a.Length; i++)
            {
                s += (a[i]);
                s2 += (b[i]);
            }

            for (int i = 0; i < a.Length; i++)
            {
                s -= (a[i]);
                s2 -= (b[i]);
            }

            Assert.AreEqual(0, s.size());
            Assert.AreEqual(0, s2.size());
        }
コード例 #2
0
        public void plusTest()
        {
            Collections.Set<int> s = new Collections.Set<int>();
            Collections.Set<int> s2 = new Collections.Set<int>();
            int[] a = { 1, 5, 6, 9 };
            int[] b = { 1, 4, 7, 9 };

            for (int i = 0; i < a.Length; i++)
            {
                s += (a[i]);
                s2 += (b[i]);
            }

            int[] res = s.Map(x => x * 1).ConvertToArray();
            CollectionAssert.AreEqual(a, res);

            Assert.AreEqual(4, s.size());
            Assert.AreEqual(4, s2.size());
        }