/********** 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 . **********/ #include #include "levenshtein.hpp" #define FAILED { std::cerr << "test failed at " << __LINE__ << std::endl; exit(EXIT_FAILURE); } int main() { if (levenshtein("abcdef", "abcdef", 6, 6) != 0) FAILED; if (levenshtein("abcdef", "abcdf", 6, 5) != 1) FAILED; if (levenshtein("abcdf", "abcdef", 5, 6) != 1) FAILED; if (levenshtein("abcdf", "abcef", 5, 5) != 1) FAILED; if (levenshtein("abcf", "abdcf", 4, 5) != 1) FAILED; if (levenshtein("lorem", "liroem", 5, 6) != 2) FAILED; if (levenshtein("abcdef", "abcdef", 6, 6) != 0) FAILED; if (levenshtein("abcdef", "abcdf", 6, 5) != 1) FAILED; if (levenshtein("abcdf", "abcdef", 5, 6) != 1) FAILED; if (levenshtein("abcdf", "abcef", 5, 5) != 1) FAILED; if (levenshtein("abcf", "abdcf", 4, 5) != 1) FAILED; if (levenshtein("lorem", "liroem", 5, 6) != 2) FAILED; std::cout << "success" << std::endl; }