Ignore:
Timestamp:
Feb 20, 2006 2:37:44 PM (18 years ago)
Author:
dkearney
Message:

adjusted copy and remove functions in core library.
added a bit of error checking in other core functions.
updated test file accordingly.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/src/RpLibrary_test.cc

    r192 r200  
    2323int test_copy (RpLibrary* fromLib, std::string fromPath,
    2424               RpLibrary* toLib, std::string toPath);
     25int test_remove (RpLibrary* lib, std::string path);
    2526
    2627int test_element (RpLibrary* lib, std::string path )
     
    172173    return retVal;
    173174}
     175
     176int test_remove (RpLibrary* lib, std::string path)
     177{
     178    RpLibrary* getRslt = NULL;
     179    int retVal = 1;
     180    std::cout << "TESTING REMOVE:" << std::endl;
     181    // std::cout << "lib's xml:" << std::endl << lib->xml() << std::endl;
     182    if (lib) {
     183        lib->remove(path);
     184        if (lib) {
     185            getRslt = lib->element(path);
     186            if (getRslt) {
     187                std::cout << "FAILURE: " << path << " not removed" << std::endl;
     188                std::cout << "lib's xml:" << std::endl << lib->xml() << std::endl;
     189            }
     190            else {
     191                std::cout << "SUCCESS: " << path << " removed" << std::endl;
     192                retVal = 0;
     193            }
     194        }
     195    }
     196
     197    return retVal;
     198}
     199
    174200
    175201/*
     
    231257    }
    232258
     259    if (!childEle) {
     260        std::cout << "No more children" << std::endl;
     261    }
     262
    233263    return retVal;
    234264}
     
    276306    test_children(lib,"input","number");
    277307
     308    std::cout << lib->xml() << std::endl;
     309
     310    RpLibrary* remEle = lib->element("input.test.(min)");
     311    test_remove(remEle,"");
     312    remEle->remove();
     313    test_remove(lib, "input.test.(min)");
     314    test_remove(lib, "input.test.(max)");
    278315    std::cout << lib->xml() << std::endl;
    279316
Note: See TracChangeset for help on using the changeset viewer.