mirror of https://git.wownero.com/dsc/mxe.git
package hunspell: create test files when required
This commit is contained in:
parent
603fd0f92a
commit
a091c1fcb6
|
@ -1,3 +0,0 @@
|
|||
# A basic .aff for a raw wordlist, created through wordlist2hunspell
|
||||
SET UTF-8
|
||||
TRY loredWH
|
|
@ -1,13 +1,25 @@
|
|||
/*
|
||||
* This file is part of MXE.
|
||||
* See index.html for further information.
|
||||
*/
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <hunspell.hxx>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Hunspell h("hunspell-test.aff", "hunspell-test.dic");
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
|
||||
std::ofstream dic ("hunspell-test.dic");
|
||||
dic << "2\nHello\nWorld";
|
||||
dic.close();
|
||||
std::ofstream aff ("hunspell-test.aff");
|
||||
aff << "SET UTF-8\nTRY loredWH\nMAXDIFF 1";
|
||||
aff.close();
|
||||
Hunspell h("hunspell-test.aff", "hunspell-test.dic");
|
||||
|
||||
if (h.spell("Hello") == 0)
|
||||
{
|
||||
std::cerr << "Error: hunspell marked correct word as wrong" << std::endl;
|
||||
|
@ -17,5 +29,9 @@ int main(int argc, char *argv[])
|
|||
std::cerr << "Error: hunspell marked wrong word as correct" << std::endl;
|
||||
}
|
||||
|
||||
char ** result;
|
||||
int n = h.suggest(&result, "ell");
|
||||
for (int i = 0; i < n; i++) std::cout << result[i];
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
2
|
||||
Hello
|
||||
World
|
|
@ -33,6 +33,4 @@ define $(PKG)_BUILD
|
|||
-W -Wall -Werror -ansi -pedantic \
|
||||
'$(2).cxx' -o '$(PREFIX)/$(TARGET)/bin/test-hunspell.exe' \
|
||||
`'$(TARGET)-pkg-config' hunspell --cflags --libs`
|
||||
# Install dummy dictionary needed by the test program
|
||||
$(INSTALL) -m644 -t '$(PREFIX)/$(TARGET)/bin' '$(TOP_DIR)/src/hunspell-test.aff' '$(TOP_DIR)/src/hunspell-test.dic'
|
||||
endef
|
||||
|
|
Loading…
Reference in New Issue