--- /dev/null
+/*
+The software in this package is distributed under the GNU General
+Public License version 2 (with a special exception described below).
+
+A copy of GNU General Public License (GPL) is included in this distribution,
+in the file COPYING.GPL.
+
+As a special exception, if other files instantiate templates or use macros
+or inline functions from this file, or you compile this file and link it
+with other works to produce a work based on this file, this file
+does not by itself cause the resulting work to be covered
+by the GNU General Public License.
+
+However the source code for this file must still be made available
+in accordance with section (3) of the GNU General Public License.
+
+This exception does not invalidate any other reasons why a work based
+on this file might be covered by the GNU General Public License.
+*/
+/**
+ i18n unit tests
+
+ @copyright Intra2net AG
+*/
+
+#define BOOST_TEST_DYN_LINK
+#include <boost/test/unit_test.hpp>
+
+#include "i18n.h"
+#include <vector>
+#include <string>
+
+using namespace std;
+
+BOOST_AUTO_TEST_SUITE(TestI18n)
+
+BOOST_AUTO_TEST_CASE(GetString)
+{
+ vector<string> data;
+ data.push_back("dummy");
+
+ string result = i18n_get_string("$0 test string", data);
+
+ BOOST_CHECK_EQUAL("dummy test string", result);
+}
+
+BOOST_AUTO_TEST_CASE(MissingParameter)
+{
+ vector<string> data;
+ string result = i18n_get_string("$0 test string", data);
+
+ BOOST_CHECK_EQUAL("i18n parameter error: missing variable ->$0<- in string ->$0 test string<-", result);
+}
+
+BOOST_AUTO_TEST_CASE(MissingNumberAfterDollar)
+{
+ vector<string> data;
+ string result = i18n_get_string("$ test string", data);
+
+ BOOST_CHECK_EQUAL("i18n syntax error: $ without number at pos ->0<- in string ->$ test string<-", result);
+}
+
+BOOST_AUTO_TEST_CASE(MissingNumberAfterDollar2)
+{
+ vector<string> data;
+ string result = i18n_get_string("$x test string", data);
+
+ BOOST_CHECK_EQUAL("i18n syntax error: $ without number at pos ->0<- in string ->$x test string<-", result);
+}
+
+BOOST_AUTO_TEST_CASE(BrokenNumberAfterDollar)
+{
+ vector<string> data;
+ string result = i18n_get_string("$x test string", data);
+
+ BOOST_CHECK_EQUAL("i18n syntax error: $ without number at pos ->0<- in string ->$x test string<-", result);
+}
+
+BOOST_AUTO_TEST_CASE(KeepEscapedDollarSign)
+{
+ vector<string> data;
+ data.push_back("dummy");
+
+ string result = i18n_get_string("$0 $$ test string", data);
+
+ BOOST_CHECK_EQUAL("dummy $ test string", result);
+}
+
+BOOST_AUTO_TEST_SUITE_END()