Changeset 173a246 in mainline


Ignore:
Timestamp:
2018-07-05T21:41:18Z (6 years ago)
Author:
Dzejrou <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
923b0c8f
Parents:
53e8686
git-author:
Jaroslav Jindrak <dzejrou@…> (2017-11-01 20:49:02)
git-committer:
Dzejrou <dzejrou@…> (2018-07-05 21:41:18)
Message:

cpp: added a test for std::string::copy

Location:
uspace/lib/cpp
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/cpp/include/internal/test/tests.hpp

    r53e8686 r173a246  
    7171            void test_erase();
    7272            void test_replace();
     73            void test_copy();
    7374    };
    7475}
  • uspace/lib/cpp/src/internal/test/string.cpp

    r53e8686 r173a246  
    4141        test_erase();
    4242        test_replace();
     43        test_copy();
    4344
    4445        return true;
     
    371372        );
    372373    }
     374
     375    void string_test::test_copy()
     376    {
     377        std::string check{"CCABB"};
     378
     379        std::string str1{"ACCCA"};
     380        std::string str2{"BBBBB"};
     381
     382        str1.copy(const_cast<char*>(str2.c_str()), 3, 2);
     383        test_eq(
     384            "copy",
     385            str2.begin(), str2.end(),
     386            check.begin(), check.end()
     387        );
     388    }
    373389}
Note: See TracChangeset for help on using the changeset viewer.