Beispiel #1
0
        public void CompareMany_channel()
        {
            var count      = 1000;
            var variants_1 = PipeDream.VariantAnnotation.Utilities.GetVariants(count);
            var variants_2 = PipeDream.VariantAnnotation.Utilities.DeepCopy(variants_1);

            var annotator = new ChannelAnnotator();

            foreach (var variant in variants_1)
            {
                SerialAnnotator.Annotate(variant);
            }

            var annotatorTask = Task.Run(async() =>
            {
                foreach (var variant in variants_2)
                {
                    await annotator.Submit(variant);
                }
                annotator.Complete();
            });

            annotatorTask.Wait();

            for (int i = 0; i < variants_1.Count; i++)
            {
                var serialJson   = Utf8Json.JsonSerializer.ToJsonString(variants_1[i]);
                var parallelJson = Utf8Json.JsonSerializer.ToJsonString(variants_2[i]);

                Assert.Equal(serialJson, parallelJson);
            }
        }
Beispiel #2
0
        public void CompareOneOutput_channel()
        {
            var position = 1234689;
            var variant1 = AnnotatedVariant.Create(position);
            var variant2 = AnnotatedVariant.Create(position);

            SerialAnnotator.Annotate(variant1);
            var serialJson = Utf8Json.JsonSerializer.ToJsonString(variant1);

            var channelAnnotator = new ChannelAnnotator();

            channelAnnotator.Submit(variant2);
            channelAnnotator.Complete();

            var parallelJson = Utf8Json.JsonSerializer.ToJsonString(variant2);

            Assert.Equal(serialJson, parallelJson);
        }