From 41714e87b6bec47a52a0aebc85517dd3b1d5d336 Mon Sep 17 00:00:00 2001 From: Neil Date: Sun, 17 Nov 2013 11:17:25 +1100 Subject: Added tests for Decoration. --- test/unit/makefile | 1 + test/unit/test.mak | 6 +++++- test/unit/testDecoration.cxx | 45 ++++++++++++++++++++++++++++++++++++++++++++ test/unit/unitTest.cxx | 2 +- 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 test/unit/testDecoration.cxx (limited to 'test') diff --git a/test/unit/makefile b/test/unit/makefile index 71e4add7c..b3621ac57 100644 --- a/test/unit/makefile +++ b/test/unit/makefile @@ -41,6 +41,7 @@ TESTSRC=test*.cxx TESTEDSRC=\ ../../src/CharClassify.cxx \ ../../src/ContractionState.cxx \ + ../../src/Decoration.cxx \ ../../src/RunStyles.cxx TESTS=$(EXE) diff --git a/test/unit/test.mak b/test/unit/test.mak index 07562e664..d224b9e91 100644 --- a/test/unit/test.mak +++ b/test/unit/test.mak @@ -11,7 +11,11 @@ CXXFLAGS = /EHsc /wd 4805 $(INCLUDEDIRS) # Files in this directory containing tests TESTSRC=test*.cxx # Files being tested from scintilla/src directory -TESTEDSRC=../../src/ContractionState.cxx ../../src/RunStyles.cxx ../../src/CharClassify.cxx +TESTEDSRC=\ + ../../src/CharClassify.cxx \ + ../../src/ContractionState.cxx \ + ../../src/Decoration.cxx \ + ../../src/RunStyles.cxx TESTS=$(EXE) diff --git a/test/unit/testDecoration.cxx b/test/unit/testDecoration.cxx new file mode 100644 index 000000000..769cf8983 --- /dev/null +++ b/test/unit/testDecoration.cxx @@ -0,0 +1,45 @@ +// Unit Tests for Scintilla internal data structures + +#include + +#include +#include + +#include "Platform.h" + +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "Decoration.h" + +#include "catch.hpp" + +const int indicator=4; + +// Test Decoration. + +TEST_CASE("Decoration") { + + Decoration deco(indicator); + + SECTION("HasCorrectIndicator") { + REQUIRE(indicator == deco.indicator); + } + + SECTION("IsEmptyInitially") { + REQUIRE(0 == deco.rs.Length()); + REQUIRE(1 == deco.rs.Runs()); + REQUIRE(deco.Empty()); + } + + SECTION("SimpleSpace") { + deco.rs.InsertSpace(0, 1); + REQUIRE(deco.Empty()); + } + + SECTION("SimpleRun") { + deco.rs.InsertSpace(0, 1); + deco.rs.SetValueAt(0, 2); + REQUIRE(!deco.Empty()); + } +} diff --git a/test/unit/unitTest.cxx b/test/unit/unitTest.cxx index 00a6a6f16..3bbe1b46a 100644 --- a/test/unit/unitTest.cxx +++ b/test/unit/unitTest.cxx @@ -7,9 +7,9 @@ RunStyles ContractionState CharClassify + Decoration To do: - Decoration DecorationList PerLine * CellBuffer * -- cgit v1.2.3