| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- /**********
- This file is part of levenshpp.
- levenshpp is free library: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
- levenshpp is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with levenshpp. If not, see <http://www.gnu.org/licenses/>.
- **********/
- #include <iostream>
- #include "levenshtein.hpp"
- #define FAILED { std::cerr << "test failed at " << __LINE__ << std::endl; exit(EXIT_FAILURE); }
- int main()
- {
- if (levenshtein<std::string, int>("abcdef", "abcdef", 6, 6) != 0)
- FAILED;
- if (levenshtein<std::string, int>("abcdef", "abcdf", 6, 5) != 1)
- FAILED;
- if (levenshtein<std::string, int>("abcdf", "abcdef", 5, 6) != 1)
- FAILED;
- if (levenshtein<std::string, int>("abcdf", "abcef", 5, 5) != 1)
- FAILED;
- if (levenshtein<std::string, int>("abcf", "abdcf", 4, 5) != 1)
- FAILED;
- if (levenshtein<std::string, int>("lorem", "liroem", 5, 6) != 2)
- FAILED;
- std::cout << "success" << std::endl;
- }
|