Example #1
0
    //全ての項目を表示
void Coverage::printCoverage(ostream & out)
{
    BranchMap * bmap = Singleton<BranchMap>::getInstance();
    BranchMap::iterator scope;

    unsigned long cases = 0;
    unsigned long fails = 0;

    scope = bmap->begin();
    while(scope != bmap->end()) {
        ++ cases;

        if(scope->second->checkValidity())
            out << "Success : ";
        else {
            out << "Failure : ";
            ++ fails;
        }
        out << scope->first.getDetails() << ' ' << scope->second->getDetails() << '\n';

        ++ scope;
    }

    out << fails << " fails in " << cases << " cases (" << setprecision(2) << (fails * 100.0 / cases) << "%)\n";
}
Example #2
0
    //locationに一致する要素の取得
Coverage::BranchBase * Coverage::BranchBase::find(const Location & location) throw()
{
    BranchMap * bmap = Singleton<BranchMap>::getInstance();
    BranchMap::iterator scope;
    BranchBase * result = 0;

    scope = bmap->find(location);
    if(scope != bmap->end())
        result = scope->second;

    return result;
}
Example #3
0
    //名称の取得
string Coverage::getBranchName(BranchBase * node)
{
        //一致する要素の検索
    BranchMap * bmap = Singleton<BranchMap>::getInstance();
    BranchMap::iterator scope;

    scope = bmap->begin();
    while(scope != bmap->end()) {
        if(scope->second == node)
            break;
        ++ scope;
    }

    //assert(scope != bmap->end());
    
    return scope->first.getDetails();
}
Example #4
0
void MusicTreeBuilder::makeTree(MusicNode *root, const MetadataPtrList &metas) 
{
    m_depth++;
        
    typedef QMap<QString, Branch*> BranchMap;
    BranchMap branches;
    
    MetadataPtrList::const_iterator it = metas.begin();
    for (; it != metas.end(); ++it)
    {
        Metadata *meta = *it;
        if (isLeafDone(meta)) 
        {
            root->addLeaf(meta);
        } 
        else 
        {
            QString field = getField(meta);
            QString field_key = field.toLower();

            if (field_key.left(4) == thePrefix) 
                field_key = field_key.mid(4);

            Branch *branch = branches[field_key];
            if (branch == NULL) 
            {
                branch = new Branch;
                branch->field = field;
                branches[field_key] = branch;
            }
            branch->list.append(meta);
        }
    }

    for (BranchMap::iterator it = branches.begin(); it != branches.end(); ++it) 
    {
        Branch *branch = *it;
        MusicNode *sub_node = createNode(branch->field);
        root->addChild(sub_node);
        makeTree(sub_node, branch->list);
        delete branch;
    }

    m_depth--;
}