mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-08 14:34:44 +02:00
Update with https://www.scintilla.org/scintilla521.zip https://www.scintilla.org/lexilla515.zip - fix setting to bring Scintilla::PositionCR from ScintillaStructures.h inline with Sci_Position.h Sci_PositionCR - add workaround to enable lexer for searchResult commented out SCI_SETILEXER call on searchResult to get one result which is correctly handled by the lexer, added comment about the current problem with property @MarkingsStruct which seems to disappear after call to SCI_SETILEXER or CreateLexer - corrected usage of ObjC lexer - removed unnecessary filter stuff - use own sections for scintilla and lexilla build targets and allow parallel builds - as libscilex is no longer existing, changed to libscintilla - adapt makefiles and cmake - use VS2019 - started simple changes for createlexer adaptations, nullpointercheck missing on return of lexer name from deprecated LexerNameFromID -> undefined behaviour - movement from id -> lexer name, mostly done via LexerNameFromID + switching off corresponding compiler warning - changed to SCI_SETILEXER from SCI_SETLEXER, SCI_SETLEXERLANGUAGE needs to be corrected, see Scintilla5Migration.html - just commented out: SCI_LOADLEXERLIBRARY Fix #10504, close #11419
74 lines
2.5 KiB
C++
74 lines
2.5 KiB
C++
/** @file testCharacterCategoryMap.cxx
|
|
** Unit Tests for Scintilla internal data structures
|
|
**/
|
|
|
|
#include <cstddef>
|
|
#include <cstring>
|
|
#include <stdexcept>
|
|
#include <string_view>
|
|
#include <vector>
|
|
#include <optional>
|
|
#include <algorithm>
|
|
#include <memory>
|
|
|
|
#include "Debugging.h"
|
|
|
|
#include "CharacterCategoryMap.h"
|
|
|
|
#include "catch.hpp"
|
|
|
|
using namespace Scintilla;
|
|
using namespace Scintilla::Internal;
|
|
|
|
// Test CharacterCategoryMap.
|
|
|
|
TEST_CASE("CharacterCategoryMap") {
|
|
|
|
CharacterCategoryMap ccm;
|
|
|
|
SECTION("LowerCaseLetter") {
|
|
const CharacterCategory cc = ccm.CategoryFor('a');
|
|
REQUIRE(cc == CharacterCategory::ccLl);
|
|
}
|
|
|
|
SECTION("All") {
|
|
REQUIRE(ccm.CategoryFor('A') == CharacterCategory::ccLu);
|
|
REQUIRE(ccm.CategoryFor('a') == CharacterCategory::ccLl);
|
|
REQUIRE(ccm.CategoryFor(0x01C5) == CharacterCategory::ccLt);
|
|
REQUIRE(ccm.CategoryFor(0x0E46) == CharacterCategory::ccLm);
|
|
REQUIRE(ccm.CategoryFor(0x4E00) == CharacterCategory::ccLo);
|
|
|
|
REQUIRE(ccm.CategoryFor(0x0300) == CharacterCategory::ccMn);
|
|
REQUIRE(ccm.CategoryFor(0x0903) == CharacterCategory::ccMc);
|
|
REQUIRE(ccm.CategoryFor(0x20E0) == CharacterCategory::ccMe);
|
|
|
|
REQUIRE(ccm.CategoryFor('7') == CharacterCategory::ccNd);
|
|
REQUIRE(ccm.CategoryFor(0x2160) == CharacterCategory::ccNl);
|
|
REQUIRE(ccm.CategoryFor(0x00BC) == CharacterCategory::ccNo);
|
|
|
|
REQUIRE(ccm.CategoryFor('_') == CharacterCategory::ccPc);
|
|
REQUIRE(ccm.CategoryFor('-') == CharacterCategory::ccPd);
|
|
REQUIRE(ccm.CategoryFor('(') == CharacterCategory::ccPs);
|
|
REQUIRE(ccm.CategoryFor('}') == CharacterCategory::ccPe);
|
|
REQUIRE(ccm.CategoryFor(0x00AB) == CharacterCategory::ccPi);
|
|
REQUIRE(ccm.CategoryFor(0x00BB) == CharacterCategory::ccPf);
|
|
REQUIRE(ccm.CategoryFor('"') == CharacterCategory::ccPo);
|
|
|
|
REQUIRE(ccm.CategoryFor('+') == CharacterCategory::ccSm);
|
|
REQUIRE(ccm.CategoryFor('$') == CharacterCategory::ccSc);
|
|
REQUIRE(ccm.CategoryFor(0x02C2) == CharacterCategory::ccSk);
|
|
REQUIRE(ccm.CategoryFor(0x00A6) == CharacterCategory::ccSo);
|
|
|
|
REQUIRE(ccm.CategoryFor(' ') == CharacterCategory::ccZs);
|
|
REQUIRE(ccm.CategoryFor(0x2028) == CharacterCategory::ccZl);
|
|
REQUIRE(ccm.CategoryFor(0x2029) == CharacterCategory::ccZp);
|
|
|
|
REQUIRE(ccm.CategoryFor('\n') == CharacterCategory::ccCc);
|
|
REQUIRE(ccm.CategoryFor(0x00AD) == CharacterCategory::ccCf);
|
|
REQUIRE(ccm.CategoryFor(0xD800) == CharacterCategory::ccCs);
|
|
REQUIRE(ccm.CategoryFor(0xE000) == CharacterCategory::ccCo);
|
|
REQUIRE(ccm.CategoryFor(0xFFFE) == CharacterCategory::ccCn);
|
|
}
|
|
|
|
}
|