Exemple #1
0
        public void TestReadFromBinaryBuffer()
        {
            int[] tmp = new int[] { 2, 48, 1, 0, 80, 4, 25, 0, 39, 4, 189, 4, 198, 3, 192, 3, 71, 4, 230, 15, 234, 15, 189, 15, 132,
                                    15, 0, 0, 0, 0, 65, 168, 10, 0, 93, 93, 8, 0, 104, 95, 8, 0, 238, 221, 9, 0, 91, 34, 63, 65, 1, 0,
                                    80, 4, 1, 0, 15, 5, 22, 6, 127, 4, 134, 4, 13, 5, 149, 19, 119, 19, 51, 19, 68, 19, 186, 42, 0, 0,
                                    221, 49, 11, 0, 101, 53, 8, 0, 168, 76, 8, 0, 80, 100, 9, 0, 5, 226, 84, 65, 1, 0, 81, 4, 25, 0, 1,
                                    4, 147, 4, 164, 3, 144, 3, 45, 4, 91, 15, 91, 15, 83, 15, 38, 15, 0, 0, 0, 0, 171, 201, 10, 0, 153,
                                    125, 8, 0, 35, 124, 8, 0, 135, 250, 9, 0, 130, 213, 59, 65 };
            byte[] expected_binary_data = new byte[tmp.Length];
            for (int i = 0; i < expected_binary_data.Length; i++)
            {
                expected_binary_data[i] = (byte)tmp[i];
            }
            run_metrics metrics = new run_metrics();

            metrics.read_metrics_from_buffer(metric_group.CorrectedInt, expected_binary_data, (uint)expected_binary_data.Length);
            Assert.AreEqual(metrics.corrected_intensity_metric_set().size(), 3u);
        }
Exemple #2
0
        public void TestWriteToBinaryBuffer()
        {
            run_metrics metrics = new run_metrics();
            base_corrected_intensity_metrics expected_metrics = metrics.corrected_intensity_metric_set();

            expected_metrics.set_version(3);
            uint_vector  calledCounts1       = new uint_vector(new uint[] { 52, 1049523, 654071, 500476, 982989 });
            float_vector correctedIntCalled1 = new float_vector(new float[] { 245, 252, 61, 235 });

            expected_metrics.insert(new corrected_intensity_metric(7, 1114, 1, correctedIntCalled1, (calledCounts1)));
            uint_vector  calledCounts2       = new uint_vector(new uint[] { 0, 1063708, 582243, 588028, 953132 });
            float_vector correctedIntCalled2 = new float_vector(new float[] { 232, 257, 68, 228 });

            expected_metrics.insert(new corrected_intensity_metric(7, 1114, 2, (correctedIntCalled2), (calledCounts2)));
            uint_vector  calledCounts3       = new uint_vector(new uint[] { 0, 1022928, 617523, 594836, 951825 });
            float_vector correctedIntCalled3 = new float_vector(new float[] { 227, 268, 68, 229 });

            expected_metrics.insert(new corrected_intensity_metric(7, 1114, 3, (correctedIntCalled3), (calledCounts3)));

            byte[] expected_binary_data = new byte[metrics.calculate_buffer_size(metric_group.CorrectedInt)];
            metrics.write_metrics_to_buffer(metric_group.CorrectedInt, expected_binary_data, (uint)expected_binary_data.Length);
        }