@@ -28,6 +28,7 @@
|
||||
F421D48B2B75177E004ECBB0 /* unicode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4C07F572AB08E690044EDC0 /* unicode.cpp */; };
|
||||
F421D48C2B751780004ECBB0 /* watchdog.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4CCA3B62B73B912007B857B /* watchdog.cpp */; };
|
||||
F421D48D2B751783004ECBB0 /* zlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F421D46B2B750BFD004ECBB0 /* zlib.cpp */; };
|
||||
F4481A1A2C73427600CED93B /* langid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4481A192C73427600CED93B /* langid.cpp */; };
|
||||
F4C07F522AB059580044EDC0 /* pch.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4C07F512AB059580044EDC0 /* pch.cpp */; };
|
||||
F4C07F552AB05B5B0044EDC0 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F4C07F542AB05B5B0044EDC0 /* main.cpp */; };
|
||||
/* End PBXBuildFile section */
|
||||
@@ -79,6 +80,7 @@
|
||||
F421D47A2B750EAE004ECBB0 /* inftrees.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inftrees.c; sourceTree = "<group>"; };
|
||||
F421D47B2B750EAE004ECBB0 /* uncompr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = uncompr.c; sourceTree = "<group>"; };
|
||||
F437AA902AC1BB64001E2230 /* hash.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = hash.cpp; sourceTree = "<group>"; };
|
||||
F4481A192C73427600CED93B /* langid.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = langid.cpp; sourceTree = "<group>"; };
|
||||
F4B7FBDC2AAF49BC00C6BE9F /* UnitTests */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = UnitTests; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
F4C07F4E2AB059300044EDC0 /* math.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = math.cpp; sourceTree = "<group>"; };
|
||||
F4C07F502AB059580044EDC0 /* pch.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pch.hpp; sourceTree = "<group>"; };
|
||||
@@ -157,6 +159,7 @@
|
||||
children = (
|
||||
F4C07F532AB05A240044EDC0 /* compat.hpp */,
|
||||
F437AA902AC1BB64001E2230 /* hash.cpp */,
|
||||
F4481A192C73427600CED93B /* langid.cpp */,
|
||||
F4C07F542AB05B5B0044EDC0 /* main.cpp */,
|
||||
F4C07F4E2AB059300044EDC0 /* math.cpp */,
|
||||
F4C07F562AB08E690044EDC0 /* parser.cpp */,
|
||||
@@ -252,6 +255,7 @@
|
||||
F421D4802B750EAE004ECBB0 /* trees.c in Sources */,
|
||||
F421D48D2B751783004ECBB0 /* zlib.cpp in Sources */,
|
||||
F421D47D2B750EAE004ECBB0 /* deflate.c in Sources */,
|
||||
F4481A1A2C73427600CED93B /* langid.cpp in Sources */,
|
||||
F421D4702B750E0F004ECBB0 /* adler32.c in Sources */,
|
||||
F421D4822B750EAE004ECBB0 /* uncompr.c in Sources */,
|
||||
F421D4742B750E21004ECBB0 /* crc32.c in Sources */,
|
||||
|
35
UnitTests/langid.cpp
Normal file
35
UnitTests/langid.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
SPDX-License-Identifier: MIT
|
||||
Copyright © 2024 Amebis
|
||||
*/
|
||||
|
||||
#include "pch.hpp"
|
||||
|
||||
using namespace std;
|
||||
#ifdef _WIN32
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
#endif
|
||||
|
||||
namespace UnitTests
|
||||
{
|
||||
void langid::from_rfc1766()
|
||||
{
|
||||
Assert::AreEqual<stdex::langid>(9, stdex::langid_from_rfc1766("en"));
|
||||
Assert::AreEqual<stdex::langid>(1033, stdex::langid_from_rfc1766("en.US"));
|
||||
Assert::AreEqual<stdex::langid>(1033, stdex::langid_from_rfc1766("en_US"));
|
||||
Assert::AreEqual<stdex::langid>(2057, stdex::langid_from_rfc1766("en.GB"));
|
||||
Assert::AreEqual<stdex::langid>(2057, stdex::langid_from_rfc1766("en_GB"));
|
||||
Assert::AreEqual<stdex::langid>(9, stdex::langid_from_rfc1766("EN"));
|
||||
Assert::AreEqual<stdex::langid>(1033, stdex::langid_from_rfc1766("EN.US"));
|
||||
Assert::AreEqual<stdex::langid>(1033, stdex::langid_from_rfc1766("EN_US"));
|
||||
Assert::AreEqual<stdex::langid>(2057, stdex::langid_from_rfc1766("EN.GB"));
|
||||
Assert::AreEqual<stdex::langid>(2057, stdex::langid_from_rfc1766("EN_GB"));
|
||||
|
||||
Assert::AreEqual<stdex::langid>(1060, stdex::langid_from_rfc1766("sl"));
|
||||
Assert::AreEqual<stdex::langid>(1060, stdex::langid_from_rfc1766("sl.SI"));
|
||||
Assert::AreEqual<stdex::langid>(1060, stdex::langid_from_rfc1766("sl_SI"));
|
||||
Assert::AreEqual<stdex::langid>(1060, stdex::langid_from_rfc1766("SL"));
|
||||
Assert::AreEqual<stdex::langid>(1060, stdex::langid_from_rfc1766("SL.SI"));
|
||||
Assert::AreEqual<stdex::langid>(1060, stdex::langid_from_rfc1766("SL_SI"));
|
||||
}
|
||||
}
|
@@ -12,24 +12,25 @@ int main(int, const char *[])
|
||||
UnitTests::hash::crc32();
|
||||
UnitTests::hash::md5();
|
||||
UnitTests::hash::sha1();
|
||||
UnitTests::math::mul();
|
||||
UnitTests::langid::from_rfc1766();
|
||||
UnitTests::math::add();
|
||||
UnitTests::parser::wtest();
|
||||
UnitTests::parser::sgml_test();
|
||||
UnitTests::math::mul();
|
||||
UnitTests::parser::http_test();
|
||||
UnitTests::parser::sgml_test();
|
||||
UnitTests::parser::wtest();
|
||||
UnitTests::pool::test();
|
||||
UnitTests::ring::test();
|
||||
UnitTests::sgml::sgml2str();
|
||||
UnitTests::sgml::str2sgml();
|
||||
UnitTests::stream::async();
|
||||
UnitTests::stream::replicator();
|
||||
UnitTests::stream::open_close();
|
||||
UnitTests::stream::file_stat();
|
||||
UnitTests::stream::open_close();
|
||||
UnitTests::stream::replicator();
|
||||
UnitTests::string::sprintf();
|
||||
UnitTests::unicode::str2wstr();
|
||||
UnitTests::unicode::wstr2str();
|
||||
UnitTests::unicode::charset_encoder();
|
||||
UnitTests::unicode::normalize();
|
||||
UnitTests::unicode::str2wstr();
|
||||
UnitTests::unicode::wstr2str();
|
||||
UnitTests::watchdog::test();
|
||||
UnitTests::zlib::test();
|
||||
std::cout << "PASS\n";
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include <stdex/html.hpp>
|
||||
#include <stdex/idrec.hpp>
|
||||
#include <stdex/interval.hpp>
|
||||
#include <stdex/langid.hpp>
|
||||
#include <stdex/locale.hpp>
|
||||
#include <stdex/mapping.hpp>
|
||||
#include <stdex/math.hpp>
|
||||
@@ -54,6 +55,12 @@ namespace UnitTests
|
||||
TEST_METHOD(sha1);
|
||||
};
|
||||
|
||||
TEST_CLASS(langid)
|
||||
{
|
||||
public:
|
||||
TEST_METHOD(from_rfc1766);
|
||||
};
|
||||
|
||||
TEST_CLASS(math)
|
||||
{
|
||||
public:
|
||||
|
Reference in New Issue
Block a user