Exemple #1
0
        public void ParseGCovOutput()
        {
            string[] output = new string[]
            {
                "        -:  148:",
                "      905:  149:                chunk_lookup += GRAPH_CHUNKLOOKUP_WIDTH;",
                "        -:  150:",
                "      905:  151:                if (chunk_offset > graph_size - the_hash_algo->rawsz) {",
                "branch  0 taken 0% (fallthrough)",
                "branch  1 taken 100%",
                "    #####:  152:                        error(_(\"improper chunk offset %08x%08x\"), (uint32_t)(chunk_offset >> 32),",
                "    $$$$$:  152-block  0",
                "call    0 never executed",
                "call    1 never executed",
                "call    2 never executed",
                "        -:  153:                              (uint32_t)chunk_offset);",
                "    #####:  154:                        goto cleanup_fail;",
                "        -:  155:                }",
                "        -:  156:",
                "      905:  157:                switch (chunk_id) {",
                "      905:  157-block  0",
                "branch  0 taken 28%",
                "branch  1 taken 28%",
                "branch  2 taken 28%",
                "branch  3 taken 16%",
                "branch  4 taken 1%",
                "      253:  158:                case GRAPH_CHUNKID_OIDFANOUT:",
                "      253:  159:                        if (graph->chunk_oid_fanout)",
                "      253:  159-block  0",
                "branch  0 taken 0% (fallthrough)",
                "branch  1 taken 100%",
                "    #####:  160:                                chunk_repeated = 1;",
                "    $$$$$:  160-block  0",
                "        -:  161:                        else",
                "      253:  162:                                graph->chunk_oid_fanout = (uint32_t*)(data + chunk_offset);",
                "      253:  162-block  0",
                "      253:  163:                        break;",
            };

            HashSet <int> lines = Collect.GetUncoveredLines(output);

            Assert.AreEqual(3, lines.Count);
            Assert.IsTrue(lines.Contains(152));
            Assert.IsTrue(lines.Contains(154));
            Assert.IsTrue(lines.Contains(160));
        }