You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.0 KiB
50 lines
1.0 KiB
/** @file testPropSetSimple.cxx
|
|
** Unit Tests for Lexilla internal data structures
|
|
**/
|
|
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
#include "PropSetSimple.h"
|
|
|
|
#include "catch.hpp"
|
|
|
|
using namespace Lexilla;
|
|
|
|
// Test PropSetSimple.
|
|
|
|
namespace {
|
|
|
|
constexpr const char *propertyName = "lexer.tex.comment.process";
|
|
constexpr const char *propertyValue = "1";
|
|
|
|
}
|
|
|
|
TEST_CASE("PropSetSimple") {
|
|
|
|
SECTION("IsEmptyInitially") {
|
|
PropSetSimple pss;
|
|
const char *value = pss.Get(propertyName);
|
|
REQUIRE_THAT(value, Catch::Matchers::Equals(""));
|
|
}
|
|
|
|
SECTION("SetAndGet") {
|
|
PropSetSimple pss;
|
|
pss.Set(propertyName, propertyValue);
|
|
const char *value = pss.Get(propertyName);
|
|
REQUIRE_THAT(value, Catch::Matchers::Equals(propertyValue));
|
|
}
|
|
|
|
SECTION("GetInt") {
|
|
PropSetSimple pss;
|
|
const int valueStart = pss.GetInt(propertyName);
|
|
REQUIRE(0 == valueStart);
|
|
const int valueDefault = pss.GetInt(propertyName, 3);
|
|
REQUIRE(3 == valueDefault);
|
|
pss.Set(propertyName, propertyValue);
|
|
const int value = pss.GetInt(propertyName);
|
|
REQUIRE(1 == value);
|
|
}
|
|
|
|
}
|