示例#1
0
        public void Test_IdSetLexicon_SingletonSets()
        {
            IdSetLexicon lexicon = new();

            Assert.Equal(5, lexicon.Add(new Seq {
                5
            }));
            Assert.Equal(0, lexicon.Add(new Seq {
                0, 0
            }));
            Assert.Equal(1, IdSetLexicon.AddSingleton(1));
            var m = int.MaxValue;

            Assert.Equal(m, lexicon.Add(new Seq {
                m
            }));

            ExpectIdSet(new IdSet {
                0
            }, lexicon.IdSet_(0));
            ExpectIdSet(new IdSet {
                1
            }, lexicon.IdSet_(1));
            ExpectIdSet(new IdSet {
                5
            }, lexicon.IdSet_(5));
            ExpectIdSet(new IdSet {
                m
            }, lexicon.IdSet_(m));
        }
        private static void VerifyS2PointVectorLayerResults(
            LabelSet label_set_ids, IdSetLexicon label_set_lexicon, List <S2Point> output,
            string str_expected_points, Int32[][] expected_labels)
        {
            var expected_points = ParsePointsOrDie(str_expected_points);

            Assert.Equal(expected_labels.Length, label_set_ids.Count);
            for (int i = 0; i < output.Count; ++i)
            {
                Assert.Equal(expected_points[i], output[i]);
                Assert.Equal(expected_labels[i].Length,
                             label_set_lexicon.IdSet_(label_set_ids[i]).Count);
                int k = 0;
                foreach (var label in label_set_lexicon.IdSet_(label_set_ids[i]))
                {
                    Assert.Equal(expected_labels[i][k++], label);
                }
            }
        }