Configures clang-format and clangd.

Runs clang-format on all c++ files.
This commit is contained in:
2023-04-21 21:55:17 -07:00
parent 64c7632806
commit 5e57ac277d
51 changed files with 6131 additions and 6019 deletions

260
.clang-format Normal file
View File

@@ -0,0 +1,260 @@
---
# https://clang.llvm.org/docs/ClangFormatStyleOptions.html
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignArrayOfStructures: None
AlignConsecutiveAssignments:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: false
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignEscapedNewlines: Left
AlignOperands: AlignAfterOperator
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: Inline
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: Yes
AttributeMacros:
- __capability
BinPackArguments: false
BinPackParameters: false
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: NonAssignment
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<ext/.*\.h>'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*\.h>'
Priority: 1
SortPriority: 0
CaseSensitive: false
- Regex: '^<.*'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 3
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '([-_](test|unittest))?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: true
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: false
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Never
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: NextLine
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
PPIndentWidth: -1
QualifierAlignment: Leave
RawStringFormats:
- Language: Cpp
Delimiters:
- cc
- CC
- cpp
- Cpp
- CPP
- 'c++'
- 'C++'
CanonicalDelimiter: ''
BasedOnStyle: google
- Language: TextProto
Delimiters:
- pb
- PB
- proto
- PROTO
EnclosingFunctions:
- EqualsProto
- EquivToProto
- PARSE_PARTIAL_TEXT_PROTO
- PARSE_TEST_PROTO
- PARSE_TEXT_PROTO
- ParseTextOrDie
- ParseTextProtoOrDie
- ParseTestProto
- ParsePartialTestProto
CanonicalDelimiter: pb
BasedOnStyle: google
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Always
ShortNamespaceLines: 1
SortIncludes: CaseSensitive
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...

1
.gitignore vendored
View File

@@ -7,3 +7,4 @@
/dos/sbf/sbf_start.command
/build
*.o
.cache

View File

@@ -63,7 +63,7 @@ MANDATORY_TARGETS = Makefile
.Phony: all clean app test run_all_tests run_incremental_tests targets docs read-docs
all: $(patsubst %, $(BUILD_DIR)/%, $(APPS)) app
all: compile_commands.json $(patsubst %, $(BUILD_DIR)/%, $(APPS)) app
clean:
rm -rf "$(BUILD_DIR)"
@@ -210,3 +210,6 @@ $(TEST_HARNESS_OBJ): $(TEST_HARNESS_CPP) $(SRC_DIR)/*.h $(TEST_CPP) $(MANDATORY_
$(TEST_HARNESS_APP): $(TEST_HARNESS_OBJ) $(APP_OBJECTS) $(TEST_OBJ) $(BUILD_DIR)/test.o $(MANDATORY_TARGETS)
$(LD) $(LDFLAGS) -o $@ $< $(APP_OBJECTS) $(TEST_OBJ) $(BUILD_DIR)/test.o
endif
compile_commands.json: $(MANDATORY_TARGETS)
make clean; bear -- make

727
compile_commands.json Normal file
View File

@@ -0,0 +1,727 @@
[
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/sbf.o",
"sbf-cpp/sbf.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/sbf.cpp",
"output": "/Users/tom/Projects/sbf2000/build/sbf.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Abilities.o",
"sbf-cpp/Abilities.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Abilities.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Abilities.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Archetypes.o",
"sbf-cpp/Archetypes.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Archetypes.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Archetypes.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Attributes.o",
"sbf-cpp/Attributes.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Attributes.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Attributes.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Backgrounds.o",
"sbf-cpp/Backgrounds.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Backgrounds.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Backgrounds.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Character.o",
"sbf-cpp/Character.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Character.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Character.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Clans.o",
"sbf-cpp/Clans.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Clans.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Clans.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Colors.o",
"sbf-cpp/Colors.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Colors.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Colors.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Derangements.o",
"sbf-cpp/Derangements.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Derangements.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Derangements.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Disciplines.o",
"sbf-cpp/Disciplines.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Disciplines.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Disciplines.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Genders.o",
"sbf-cpp/Genders.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Genders.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Genders.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Ranks.o",
"sbf-cpp/Ranks.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Ranks.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Ranks.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Utils.o",
"sbf-cpp/Utils.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Utils.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Utils.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Virtues.o",
"sbf-cpp/Virtues.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Virtues.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Virtues.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Abilities_test.o",
"sbf-cpp/Abilities_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Abilities_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Abilities_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Archetypes_test.o",
"sbf-cpp/Archetypes_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Archetypes_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Archetypes_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Attributes_test.o",
"sbf-cpp/Attributes_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Attributes_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Attributes_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Backgrounds_test.o",
"sbf-cpp/Backgrounds_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Backgrounds_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Backgrounds_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Character_test.o",
"sbf-cpp/Character_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Character_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Character_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Clans_test.o",
"sbf-cpp/Clans_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Clans_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Clans_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Colors_test.o",
"sbf-cpp/Colors_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Colors_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Colors_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Derangements_test.o",
"sbf-cpp/Derangements_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Derangements_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Derangements_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Disciplines_test.o",
"sbf-cpp/Disciplines_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Disciplines_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Disciplines_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Genders_test.o",
"sbf-cpp/Genders_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Genders_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Genders_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Ranks_test.o",
"sbf-cpp/Ranks_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Ranks_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Ranks_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Utils_test.o",
"sbf-cpp/Utils_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Utils_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Utils_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/Virtues_test.o",
"sbf-cpp/Virtues_test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/Virtues_test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/Virtues_test.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/test_main.o",
"build/test_main.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/build/test_main.cpp",
"output": "/Users/tom/Projects/sbf2000/build/test_main.o"
},
{
"arguments": [
"/usr/bin/clang++",
"-std=c++17",
"-Wall",
"-fno-objc-arc",
"-finput-charset=UTF-8",
"-Isbf-cpp",
"-I/opt/homebrew/opt/ncurses/include",
"-O2",
"-arch",
"arm64",
"-arch",
"x86_64",
"-fdiagnostics-show-template-tree",
"-fno-elide-type",
"-c",
"-o",
"build/test.o",
"sbf-cpp/test.cpp"
],
"directory": "/Users/tom/Projects/sbf2000",
"file": "/Users/tom/Projects/sbf2000/sbf-cpp/test.cpp",
"output": "/Users/tom/Projects/sbf2000/build/test.o"
}
]

View File

@@ -1,23 +1,21 @@
#include "Abilities.h"
#include <string>
#include <iostream>
#include <string>
namespace SBF {
using std::string;
using std::ostream;
using std::string;
using std::vector;
ostream& operator<<(ostream& os, const AbilityType& ability) {
os << "AbilityGroup: {id: " << ability.id
<< ", singular: \"" << ability.singular
<< "\", plural: \"" << ability.plural << "\"}";
os << "AbilityGroup: {id: " << ability.id << ", singular: \"" << ability.singular << "\", plural: \""
<< ability.plural << "\"}";
return os;
}
bool operator==(const AbilityType& left, const AbilityType& right) {
return left.id == right.id &&
left.singular == right.singular &&
left.plural == right.plural;
return left.id == right.id && left.singular == right.singular && left.plural == right.plural;
}
bool operator!=(const AbilityType& left, const AbilityType& right) {

View File

@@ -36,10 +36,23 @@ namespace SBF {
/// @brief The plural form of this group i.e. Talents.
std::string plural;
};
const AbilityType kAbilityGroupUnknown = {0, "", ""};
const AbilityType kAbilityGroupTalents = {kAbilityTalentsId, kAbilityTalentsSingular, kAbilityTalentsPlural};
const AbilityType kAbilityGroupSkills = {kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural};
const AbilityType kAbilityGroupKnowledges = {kAbilityKnowledgesId, kAbilityKnowledgesSingular, kAbilityKnowledgesPlural};
const AbilityType kAbilityGroupTalents = {
kAbilityTalentsId,
kAbilityTalentsSingular,
kAbilityTalentsPlural,
};
const AbilityType kAbilityGroupSkills = {
kAbilitySkillsId,
kAbilitySkillsSingular,
kAbilitySkillsPlural,
};
const AbilityType kAbilityGroupKnowledges = {
kAbilityKnowledgesId,
kAbilityKnowledgesSingular,
kAbilityKnowledgesPlural,
};
const AbilityType kAbilities[]{
kAbilityGroupUnknown,
kAbilityGroupTalents,
@@ -176,12 +189,14 @@ namespace SBF {
/// @param abilities The vector to fill.
void FillAbilities(std::vector<AbilityType>& abilities);
/// @brief Fills the provided vector with all of the ability labels in the specified group. It will be cleared before filling.
/// @brief Fills the provided vector with all of the ability labels in the specified group. It will be cleared before
/// filling.
/// @param abilities The vector to fill.
/// @param id The id of the ability group to fill for.
void FillAbilitiesForAbilityGroup(std::vector<std::string>& abilities, int id);
/// @brief Fills the provided vector with all of the ability labels in the specified group. It will be cleared before filling.
/// @brief Fills the provided vector with all of the ability labels in the specified group. It will be cleared before
/// filling.
/// @param labels The vector to fill.
/// @param id The id of the ability group to fill for.
void FillAbilityLabels(std::vector<std::string>& labels, int id);
@@ -203,7 +218,8 @@ namespace SBF {
/// @return The ability group with an id of id or kAbilityGroupUnknown if id is invalid.
const AbilityType& GetAbility(int id);
/// @brief Gets the label for an ability given its ability group (talents/skills/knowledges) and its id (acting, brawl, dodge, ...).
/// @brief Gets the label for an ability given its ability group (talents/skills/knowledges) and its id (acting, brawl,
/// dodge, ...).
/// @param group_id The id for the ability group (talents/skills/knowledges).
/// @param id The id for the ability within the ability group (acting, dodge, brawl, ...).
/// @return The label for the specific ability ("Acting").
@@ -229,5 +245,6 @@ namespace SBF {
/// @return The label for the specific ability.
const std::string GetTalentLabel(int id);
} // End namespace SBF
/** @}*/
#endif // End !defined ABILITIES_H__

View File

@@ -1,7 +1,9 @@
#include "Abilities.h"
#include "test.h"
#include <iostream>
#include <sstream>
#include "test.h"
using namespace SBF;
using namespace Test;
using namespace std;
@@ -23,9 +25,10 @@ namespace Test::Abilities {
TestResults test_GetSkillLabel();
TestResults test_GetTalentLabel();
} // End namespace Test::Abilities
using namespace Test::Abilities;
TestResults main_test_Abilities(int argc, char** argv) {
TestResults main_test_Abilities(int argc, char* argv[]) {
TestResults results;
results += test_AbilityType_operator_extract();
@@ -49,8 +52,7 @@ TestResults main_test_Abilities(int argc, char** argv) {
namespace Test::Abilities {
TestResults test_AbilityType_operator_extract() {
return execute_suite<string, AbilityType>(
make_test_suite(
return execute_suite<string, AbilityType>(make_test_suite(
"SBF::AbilityType::operator<<",
[](const AbilityType& ability) {
ostringstream os;
@@ -58,77 +60,61 @@ namespace Test::Abilities {
return os.str();
},
vector<TestTuple<string, AbilityType>>({
make_test<string, AbilityType>(
"should print talents",
make_test<string, AbilityType>("should print talents",
"AbilityGroup: {id: 1, singular: \"Talent\", plural: \"Talents\"}",
make_tuple(kAbilityGroupTalents)),
make_test<string, AbilityType>(
"should print skills",
make_test<string, AbilityType>("should print skills",
"AbilityGroup: {id: 2, singular: \"Skill\", plural: \"Skills\"}",
make_tuple(kAbilityGroupSkills)),
make_test<string, AbilityType>(
"should print knowledges",
make_test<string, AbilityType>("should print knowledges",
"AbilityGroup: {id: 3, singular: \"Knowledge\", plural: \"Knowledges\"}",
make_tuple(kAbilityGroupKnowledges)),
make_test<string, AbilityType>(
"should print an unknown ability group",
make_test<string, AbilityType>("should print an unknown ability group",
"AbilityGroup: {id: 0, singular: \"\", plural: \"\"}",
make_tuple(kAbilityGroupUnknown)),
})
));
})));
}
TestResults test_AbilityType_operator_equal_to() {
return execute_suite<bool, AbilityType, AbilityType>(
make_test_suite(
return execute_suite<bool, AbilityType, AbilityType>(make_test_suite(
"SBF::AbilityType::operator==",
[](const AbilityType& left, const AbilityType& right) {
return left == right;
},
[](const AbilityType& left, const AbilityType& right) { return left == right; },
vector<TestTuple<bool, AbilityType, AbilityType>>({
make_test<bool, AbilityType, AbilityType>(
"should return true when comparing an ability group to itself",
make_test<bool, AbilityType, AbilityType>("should return true when comparing an ability group to itself",
true,
make_tuple(kAbilityGroupTalents, kAbilityGroupTalents)),
make_test<bool, AbilityType, AbilityType>(
"should return true when comparing two different instances created with the same values",
true,
make_tuple(kAbilityGroupSkills, AbilityType({kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural}))),
make_test<bool, AbilityType, AbilityType>(
"should return false when comparing two different ability gropus",
make_tuple(kAbilityGroupSkills,
AbilityType({kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural}))),
make_test<bool, AbilityType, AbilityType>("should return false when comparing two different ability gropus",
false,
make_tuple(kAbilityGroupKnowledges, kAbilityGroupSkills)),
})
));
})));
}
TestResults test_AbilityType_operator_not_equal_to() {
return execute_suite<bool, AbilityType, AbilityType>(
make_test_suite(
return execute_suite<bool, AbilityType, AbilityType>(make_test_suite(
"SBF::AbilityType::operator!=",
[](const AbilityType& left, const AbilityType& right) {
return left != right;
},
[](const AbilityType& left, const AbilityType& right) { return left != right; },
vector<TestTuple<bool, AbilityType, AbilityType>>({
make_test<bool, AbilityType, AbilityType>(
"should return false when comparing an ability group to itself",
make_test<bool, AbilityType, AbilityType>("should return false when comparing an ability group to itself",
false,
make_tuple(kAbilityGroupTalents, kAbilityGroupTalents)),
make_test<bool, AbilityType, AbilityType>(
"should return false when comparing two different instances created with the same values",
false,
make_tuple(kAbilityGroupSkills, AbilityType({kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural}))),
make_test<bool, AbilityType, AbilityType>(
"should return true when comparing two different ability gropus",
make_tuple(kAbilityGroupSkills,
AbilityType({kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural}))),
make_test<bool, AbilityType, AbilityType>("should return true when comparing two different ability gropus",
true,
make_tuple(kAbilityGroupKnowledges, kAbilityGroupSkills)),
})
));
})));
}
TestResults test_FillAbilities() {
return execute_suite<string>(
make_test_suite(
return execute_suite<string>(make_test_suite(
"SBF::FillAbilities",
[]() -> string {
ostringstream error_message;
@@ -143,17 +129,12 @@ namespace Test::Abilities {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill abilities",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill abilities", "no errors", make_tuple()),
})));
}
TestResults test_FillAbilitiesForAbilityGroup() {
return execute_suite<vector<string>, int>(
make_test_suite(
return execute_suite<vector<string>, int>(make_test_suite(
"SBF::FillAbilitiesForAbilityGroup",
[](int groupId) {
vector<string> abilities = {"This should be removed."};
@@ -162,32 +143,53 @@ namespace Test::Abilities {
},
vector<TestTuple<vector<string>, int>>({
make_test<vector<string>, int>(
"should clear the vector for group 0, kAbilityGropuUnknownId",
{},
make_tuple(0)),
make_test<vector<string>, int>(
"should fill talents for group 1 kAbilityGroupTalentsId",
{"", "Acting", "Alertness", "Athletics", "Brawl", "Dodge", "Empathy", "Intimidation", "Leadership", "Streetwise", "Subterfuge"},//, "Alertness", "Athletics", "Brawl", "Dodge", "Empathy", "Intimidation", "Leadership", "Streetwise", "Subterfuge"
"should clear the vector for group 0, kAbilityGropuUnknownId", {}, make_tuple(0)),
make_test<vector<string>, int>("should fill talents for group 1 kAbilityGroupTalentsId",
{"",
"Acting",
"Alertness",
"Athletics",
"Brawl",
"Dodge",
"Empathy",
"Intimidation",
"Leadership",
"Streetwise",
"Subterfuge"}, //, "Alertness", "Athletics", "Brawl", "Dodge", "Empathy",
//"Intimidation", "Leadership", "Streetwise", "Subterfuge"
make_tuple(1)),
make_test<vector<string>, int>(
"should fill skills for group 2 kAbilityGroupSkillsId",
{"", "Animal Ken", "Drive", "Etiquette", "Firearms", "Melee", "Music", "Repair", "Security", "Stealth", "Survival"},
make_test<vector<string>, int>("should fill skills for group 2 kAbilityGroupSkillsId",
{"",
"Animal Ken",
"Drive",
"Etiquette",
"Firearms",
"Melee",
"Music",
"Repair",
"Security",
"Stealth",
"Survival"},
make_tuple(2)),
make_test<vector<string>, int>(
"should fill knowledges for group 3 kAbilityGroupKnowledgesId",
{"", "Bureaucracy", "Computer", "Finance", "Investigation", "Law", "Linguistics", "Medicine", "Occult", "Politics", "Science"},
make_test<vector<string>, int>("should fill knowledges for group 3 kAbilityGroupKnowledgesId",
{"",
"Bureaucracy",
"Computer",
"Finance",
"Investigation",
"Law",
"Linguistics",
"Medicine",
"Occult",
"Politics",
"Science"},
make_tuple(3)),
make_test<vector<string>, int>(
"should clear the vector for group 4 an invalid id",
{},
make_tuple(4)),
})
));
make_test<vector<string>, int>("should clear the vector for group 4 an invalid id", {}, make_tuple(4)),
})));
}
TestResults test_FillAbilityLabels() {
return execute_suite<vector<string>, int>(
make_test_suite(
return execute_suite<vector<string>, int>(make_test_suite(
"SBF::FillAbilityLabels",
[](int groupId) {
vector<string> abilities = {"This should be removed."};
@@ -196,37 +198,67 @@ namespace Test::Abilities {
},
vector<TestTuple<vector<string>, int>>({
make_test<vector<string>, int>(
"should clear the vector for group 0, kAbilityGropuUnknownId",
{},
make_tuple(0)),
make_test<vector<string>, int>(
"should fill talents for group 1 kAbilityGroupTalentsId",
{"", "Acting", "Alertness", "Athletics", "Brawl", "Dodge", "Empathy", "Intimidation", "Leadership", "Streetwise", "Subterfuge"},
"should clear the vector for group 0, kAbilityGropuUnknownId", {}, make_tuple(0)),
make_test<vector<string>, int>("should fill talents for group 1 kAbilityGroupTalentsId",
{"",
"Acting",
"Alertness",
"Athletics",
"Brawl",
"Dodge",
"Empathy",
"Intimidation",
"Leadership",
"Streetwise",
"Subterfuge"},
make_tuple(1)),
make_test<vector<string>, int>(
"should fill skills for group 2 kAbilityGroupSkillsId",
{"", "Animal Ken", "Drive", "Etiquette", "Firearms", "Melee", "Music", "Repair", "Security", "Stealth", "Survival"},
make_test<vector<string>, int>("should fill skills for group 2 kAbilityGroupSkillsId",
{"",
"Animal Ken",
"Drive",
"Etiquette",
"Firearms",
"Melee",
"Music",
"Repair",
"Security",
"Stealth",
"Survival"},
make_tuple(2)),
make_test<vector<string>, int>(
"should fill knowledges for group 3 kAbilityGroupKnowledgesId",
{"", "Bureaucracy", "Computer", "Finance", "Investigation", "Law", "Linguistics", "Medicine", "Occult", "Politics", "Science"},
make_test<vector<string>, int>("should fill knowledges for group 3 kAbilityGroupKnowledgesId",
{"",
"Bureaucracy",
"Computer",
"Finance",
"Investigation",
"Law",
"Linguistics",
"Medicine",
"Occult",
"Politics",
"Science"},
make_tuple(3)),
make_test<vector<string>, int>(
"should clear the vector for group 4 an invalid id",
{},
make_tuple(4)),
})
));
make_test<vector<string>, int>("should clear the vector for group 4 an invalid id", {}, make_tuple(4)),
})));
}
TestResults test_FillKnowledgeLabels() {
return execute_suite<string>(
make_test_suite(
return execute_suite<string>(make_test_suite(
"SBF::FillKnowlegeLabels",
[]() -> string {
ostringstream error_message;
vector<string> actual = {"This should be removed."};
vector<string> expected = {"", "Bureaucracy", "Computer", "Finance", "Investigation", "Law", "Linguistics", "Medicine", "Occult", "Politics", "Science"};
vector<string> expected = {"",
"Bureaucracy",
"Computer",
"Finance",
"Investigation",
"Law",
"Linguistics",
"Medicine",
"Occult",
"Politics",
"Science"};
FillKnowledgeLabels(actual);
compare(error_message, expected, actual);
string error = error_message.str();
@@ -236,22 +268,27 @@ namespace Test::Abilities {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill knowledge labels",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill knowledge labels", "no errors", make_tuple()),
})));
}
TestResults test_FillSkillLabels() {
return execute_suite<string>(
make_test_suite(
return execute_suite<string>(make_test_suite(
"SBF::FillSkillLabels",
[]() -> string {
ostringstream error_message;
vector<string> actual = {"This should be removed."};
vector<string> expected = {"", "Animal Ken", "Drive", "Etiquette", "Firearms", "Melee", "Music", "Repair", "Security", "Stealth", "Survival"};
vector<string> expected = {"",
"Animal Ken",
"Drive",
"Etiquette",
"Firearms",
"Melee",
"Music",
"Repair",
"Security",
"Stealth",
"Survival"};
FillSkillLabels(actual);
compare(error_message, expected, actual);
string error = error_message.str();
@@ -261,22 +298,27 @@ namespace Test::Abilities {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill skill labels",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill skill labels", "no errors", make_tuple()),
})));
}
TestResults test_FillTalentLabels() {
return execute_suite<string>(
make_test_suite(
return execute_suite<string>(make_test_suite(
"SBF::FillTalentLabels",
[]() -> string {
ostringstream error_message;
vector<string> actual = {"This should be removed."};
vector<string> expected = {"", "Acting", "Alertness", "Athletics", "Brawl", "Dodge", "Empathy", "Intimidation", "Leadership", "Streetwise", "Subterfuge"};
vector<string> expected = {"",
"Acting",
"Alertness",
"Athletics",
"Brawl",
"Dodge",
"Empathy",
"Intimidation",
"Leadership",
"Streetwise",
"Subterfuge"};
FillTalentLabels(actual);
compare(error_message, expected, actual);
string error = error_message.str();
@@ -286,394 +328,137 @@ namespace Test::Abilities {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill knowledge labels",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill knowledge labels", "no errors", make_tuple()),
})));
}
TestResults test_GetAbility() {
return execute_suite<AbilityType, int>(
make_test_suite(
return execute_suite<AbilityType, int>(make_test_suite(
"SBF::GetAbility",
GetAbility,
vector<TestTuple<AbilityType, int>>({
make_test<AbilityType, int>("should get talents", kAbilityGroupTalents, make_tuple(kAbilityTalentsId)),
make_test<AbilityType, int>("should get skills", kAbilityGroupSkills, make_tuple(kAbilitySkillsId)),
make_test<AbilityType, int>(
"should get talents",
kAbilityGroupTalents,
make_tuple(kAbilityTalentsId)),
make_test<AbilityType, int>(
"should get skills",
kAbilityGroupSkills,
make_tuple(kAbilitySkillsId)),
make_test<AbilityType, int>(
"should get knowledges",
kAbilityGroupKnowledges,
make_tuple(kAbilityKnowledgesId)),
make_test<AbilityType, int>(
"should get unknown for id 0",
kAbilityGroupUnknown,
make_tuple(0)),
make_test<AbilityType, int>(
"should get unknown for an invalid id",
kAbilityGroupUnknown,
make_tuple(4)),
})
)
);
"should get knowledges", kAbilityGroupKnowledges, make_tuple(kAbilityKnowledgesId)),
make_test<AbilityType, int>("should get unknown for id 0", kAbilityGroupUnknown, make_tuple(0)),
make_test<AbilityType, int>("should get unknown for an invalid id", kAbilityGroupUnknown, make_tuple(4)),
})));
}
TestResults test_GetAbilityLabel() {
return execute_suite<string, int, int>(
make_test_suite(
return execute_suite<string, int, int>(make_test_suite(
"SBF::GetAbilityLabel",
GetAbilityLabel,
vector<TestTuple<string, int, int>>({
make_test<string, int, int>("should get Acting for group 1 and id 1", "Acting", make_tuple(1, 1)),
make_test<string, int, int>("should get Alertness for group 1 and id 2", "Alertness", make_tuple(1, 2)),
make_test<string, int, int>("should get Athletics for group 1 and id 3", "Athletics", make_tuple(1, 3)),
make_test<string, int, int>("should get Brawl for group 1 and id 4", "Brawl", make_tuple(1, 4)),
make_test<string, int, int>("should get Dodge for group 1 and id 5", "Dodge", make_tuple(1, 5)),
make_test<string, int, int>("should get Empathy for group 1 and id 6", "Empathy", make_tuple(1, 6)),
make_test<string, int, int>("should get Intimidation for group 1 and id 7", "Intimidation", make_tuple(1, 7)),
make_test<string, int, int>("should get Leadership for group 1 and id 8", "Leadership", make_tuple(1, 8)),
make_test<string, int, int>("should get Streetwise for group 1 and id 9", "Streetwise", make_tuple(1, 9)),
make_test<string, int, int>("should get Subterfuge for group 1 and id 10", "Subterfuge", make_tuple(1, 10)),
make_test<string, int, int>("should get Animal Ken for group 2 and id 1", "Animal Ken", make_tuple(2, 1)),
make_test<string, int, int>("should get Drive for group 2 and id 2", "Drive", make_tuple(2, 2)),
make_test<string, int, int>("should get Etiquette for group 2 and id 3", "Etiquette", make_tuple(2, 3)),
make_test<string, int, int>("should get Firearms for group 2 and id 4", "Firearms", make_tuple(2, 4)),
make_test<string, int, int>("should get Melee for group 2 and id 5", "Melee", make_tuple(2, 5)),
make_test<string, int, int>("should get Music for group 2 and id 6", "Music", make_tuple(2, 6)),
make_test<string, int, int>("should get Repair for group 2 and id 7", "Repair", make_tuple(2, 7)),
make_test<string, int, int>("should get Security for group 2 and id 8", "Security", make_tuple(2, 8)),
make_test<string, int, int>("should get Stealth for group 2 and id 9", "Stealth", make_tuple(2, 9)),
make_test<string, int, int>("should get Survival for group 2 and id 10", "Survival", make_tuple(2, 10)),
make_test<string, int, int>("should get Bureaucracy for group 3 and id 1", "Bureaucracy", make_tuple(3, 1)),
make_test<string, int, int>("should get Computer for group 3 and id 2", "Computer", make_tuple(3, 2)),
make_test<string, int, int>("should get Finance for group 3 and id 3", "Finance", make_tuple(3, 3)),
make_test<string, int, int>(
"should get Acting for group 1 and id 1",
"Acting",
make_tuple(1, 1)),
make_test<string, int, int>(
"should get Alertness for group 1 and id 2",
"Alertness",
make_tuple(1, 2)),
make_test<string, int, int>(
"should get Athletics for group 1 and id 3",
"Athletics",
make_tuple(1, 3)),
make_test<string, int, int>(
"should get Brawl for group 1 and id 4",
"Brawl",
make_tuple(1, 4)),
make_test<string, int, int>(
"should get Dodge for group 1 and id 5",
"Dodge",
make_tuple(1, 5)),
make_test<string, int, int>(
"should get Empathy for group 1 and id 6",
"Empathy",
make_tuple(1, 6)),
make_test<string, int, int>(
"should get Intimidation for group 1 and id 7",
"Intimidation",
make_tuple(1, 7)),
make_test<string, int, int>(
"should get Leadership for group 1 and id 8",
"Leadership",
make_tuple(1, 8)),
make_test<string, int, int>(
"should get Streetwise for group 1 and id 9",
"Streetwise",
make_tuple(1, 9)),
make_test<string, int, int>(
"should get Subterfuge for group 1 and id 10",
"Subterfuge",
make_tuple(1, 10)),
make_test<string, int, int>(
"should get Animal Ken for group 2 and id 1",
"Animal Ken",
make_tuple(2, 1)),
make_test<string, int, int>(
"should get Drive for group 2 and id 2",
"Drive",
make_tuple(2, 2)),
make_test<string, int, int>(
"should get Etiquette for group 2 and id 3",
"Etiquette",
make_tuple(2, 3)),
make_test<string, int, int>(
"should get Firearms for group 2 and id 4",
"Firearms",
make_tuple(2, 4)),
make_test<string, int, int>(
"should get Melee for group 2 and id 5",
"Melee",
make_tuple(2, 5)),
make_test<string, int, int>(
"should get Music for group 2 and id 6",
"Music",
make_tuple(2, 6)),
make_test<string, int, int>(
"should get Repair for group 2 and id 7",
"Repair",
make_tuple(2, 7)),
make_test<string, int, int>(
"should get Security for group 2 and id 8",
"Security",
make_tuple(2, 8)),
make_test<string, int, int>(
"should get Stealth for group 2 and id 9",
"Stealth",
make_tuple(2, 9)),
make_test<string, int, int>(
"should get Survival for group 2 and id 10",
"Survival",
make_tuple(2, 10)),
make_test<string, int, int>(
"should get Bureaucracy for group 3 and id 1",
"Bureaucracy",
make_tuple(3, 1)),
make_test<string, int, int>(
"should get Computer for group 3 and id 2",
"Computer",
make_tuple(3, 2)),
make_test<string, int, int>(
"should get Finance for group 3 and id 3",
"Finance",
make_tuple(3, 3)),
make_test<string, int, int>(
"should get Investigation for group 3 and id 4",
"Investigation",
make_tuple(3, 4)),
make_test<string, int, int>(
"should get Law for group 3 and id 5",
"Law",
make_tuple(3, 5)),
make_test<string, int, int>(
"should get Linguistics for group 3 and id 6",
"Linguistics",
make_tuple(3, 6)),
make_test<string, int, int>(
"should get Medicine for group 3 and id 7",
"Medicine",
make_tuple(3, 7)),
make_test<string, int, int>(
"should get Occult for group 3 and id 8",
"Occult",
make_tuple(3, 8)),
make_test<string, int, int>(
"should get Politics for group 3 and id 9",
"Politics",
make_tuple(3, 9)),
make_test<string, int, int>(
"should get Science for group 3 and id 10",
"Science",
make_tuple(3, 10)),
make_test<string, int, int>(
"should get and empty string for group 0 and id 0",
"",
make_tuple(0, 0)),
make_test<string, int, int>(
"should get and empty string for group 1 and id 11",
"",
make_tuple(1, 11)),
make_test<string, int, int>(
"should get and empty string for group 4 and id 1",
"",
make_tuple(4, 1)),
})
)
);
"should get Investigation for group 3 and id 4", "Investigation", make_tuple(3, 4)),
make_test<string, int, int>("should get Law for group 3 and id 5", "Law", make_tuple(3, 5)),
make_test<string, int, int>("should get Linguistics for group 3 and id 6", "Linguistics", make_tuple(3, 6)),
make_test<string, int, int>("should get Medicine for group 3 and id 7", "Medicine", make_tuple(3, 7)),
make_test<string, int, int>("should get Occult for group 3 and id 8", "Occult", make_tuple(3, 8)),
make_test<string, int, int>("should get Politics for group 3 and id 9", "Politics", make_tuple(3, 9)),
make_test<string, int, int>("should get Science for group 3 and id 10", "Science", make_tuple(3, 10)),
make_test<string, int, int>("should get and empty string for group 0 and id 0", "", make_tuple(0, 0)),
make_test<string, int, int>("should get and empty string for group 1 and id 11", "", make_tuple(1, 11)),
make_test<string, int, int>("should get and empty string for group 4 and id 1", "", make_tuple(4, 1)),
})));
}
TestResults test_GetKnowledgeLabel() {
return execute_suite<string, int>(
make_test_suite(
"SBF::GetKnowledgeLabel",
make_test_suite("SBF::GetKnowledgeLabel",
GetKnowledgeLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get Bureaucracy for id 1",
"Bureaucracy",
make_tuple(1)),
make_test<string, int>(
"should get Computer for id 2",
"Computer",
make_tuple(2)),
make_test<string, int>(
"should get Finance for id 3",
"Finance",
make_tuple(3)),
make_test<string, int>(
"should get Investigation for id 4",
"Investigation",
make_tuple(4)),
make_test<string, int>(
"should get Law for id 5",
"Law",
make_tuple(5)),
make_test<string, int>(
"should get Linguistics for id 6",
"Linguistics",
make_tuple(6)),
make_test<string, int>(
"should get Medicine for id 7",
"Medicine",
make_tuple(7)),
make_test<string, int>(
"should get Occult for id 8",
"Occult",
make_tuple(8)),
make_test<string, int>(
"should get Politics for id 9",
"Politics",
make_tuple(9)),
make_test<string, int>(
"should get Science for id 10",
"Science",
make_tuple(10)),
make_test<string, int>(
"should get and empty string for id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get and empty string for id 11",
"",
make_tuple(11)),
})
)
);
make_test<string, int>("should get Bureaucracy for id 1", "Bureaucracy", make_tuple(1)),
make_test<string, int>("should get Computer for id 2", "Computer", make_tuple(2)),
make_test<string, int>("should get Finance for id 3", "Finance", make_tuple(3)),
make_test<string, int>("should get Investigation for id 4", "Investigation", make_tuple(4)),
make_test<string, int>("should get Law for id 5", "Law", make_tuple(5)),
make_test<string, int>("should get Linguistics for id 6", "Linguistics", make_tuple(6)),
make_test<string, int>("should get Medicine for id 7", "Medicine", make_tuple(7)),
make_test<string, int>("should get Occult for id 8", "Occult", make_tuple(8)),
make_test<string, int>("should get Politics for id 9", "Politics", make_tuple(9)),
make_test<string, int>("should get Science for id 10", "Science", make_tuple(10)),
make_test<string, int>("should get and empty string for id 0", "", make_tuple(0)),
make_test<string, int>("should get and empty string for id 11", "", make_tuple(11)),
})));
return TestResults();
}
TestResults test_GetNumItemsForAbilityGroup() {
return execute_suite<int, int>(
make_test_suite(
return execute_suite<int, int>(make_test_suite(
"SBF::GetNumItemsForAbilityGroup",
GetNumItemsForAbilityGroup,
vector<TestTuple<int, int>>({
make_test<int, int>(
"should get 10 abilities for talents",
10,
make_tuple(kAbilityTalentsId)),
make_test<int, int>(
"should get 10 abilities for skills",
10,
make_tuple(kAbilitySkillsId)),
make_test<int, int>(
"should get 10 abilities for knowledges",
10,
make_tuple(kAbilityKnowledgesId)),
make_test<int, int>(
"should get 0 abilities for 0",
0,
make_tuple(0)),
make_test<int, int>(
"should get 0 abilities for an invalid id",
0,
make_tuple(4)),
})
)
);
make_test<int, int>("should get 10 abilities for talents", 10, make_tuple(kAbilityTalentsId)),
make_test<int, int>("should get 10 abilities for skills", 10, make_tuple(kAbilitySkillsId)),
make_test<int, int>("should get 10 abilities for knowledges", 10, make_tuple(kAbilityKnowledgesId)),
make_test<int, int>("should get 0 abilities for 0", 0, make_tuple(0)),
make_test<int, int>("should get 0 abilities for an invalid id", 0, make_tuple(4)),
})));
}
TestResults test_GetSkillLabel() {
return execute_suite<string, int>(
make_test_suite(
"SBF::GetSkillLabel",
make_test_suite("SBF::GetSkillLabel",
GetSkillLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get Animal Ken for id 1",
"Animal Ken",
make_tuple(1)),
make_test<string, int>(
"should get Drive for id 2",
"Drive",
make_tuple(2)),
make_test<string, int>(
"should get Etiquette for id 3",
"Etiquette",
make_tuple(3)),
make_test<string, int>(
"should get Firearms for id 4",
"Firearms",
make_tuple(4)),
make_test<string, int>(
"should get Melee for id 5",
"Melee",
make_tuple(5)),
make_test<string, int>(
"should get Music for id 6",
"Music",
make_tuple(6)),
make_test<string, int>(
"should get Repair for id 7",
"Repair",
make_tuple(7)),
make_test<string, int>(
"should get Security for id 8",
"Security",
make_tuple(8)),
make_test<string, int>(
"should get Stealth for id 9",
"Stealth",
make_tuple(9)),
make_test<string, int>(
"should get Survival for id 10",
"Survival",
make_tuple(10)),
make_test<string, int>(
"should get and empty string for id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get and empty string for id 11",
"",
make_tuple(11)),
})
)
);
make_test<string, int>("should get Animal Ken for id 1", "Animal Ken", make_tuple(1)),
make_test<string, int>("should get Drive for id 2", "Drive", make_tuple(2)),
make_test<string, int>("should get Etiquette for id 3", "Etiquette", make_tuple(3)),
make_test<string, int>("should get Firearms for id 4", "Firearms", make_tuple(4)),
make_test<string, int>("should get Melee for id 5", "Melee", make_tuple(5)),
make_test<string, int>("should get Music for id 6", "Music", make_tuple(6)),
make_test<string, int>("should get Repair for id 7", "Repair", make_tuple(7)),
make_test<string, int>("should get Security for id 8", "Security", make_tuple(8)),
make_test<string, int>("should get Stealth for id 9", "Stealth", make_tuple(9)),
make_test<string, int>("should get Survival for id 10", "Survival", make_tuple(10)),
make_test<string, int>("should get and empty string for id 0", "", make_tuple(0)),
make_test<string, int>("should get and empty string for id 11", "", make_tuple(11)),
})));
}
TestResults test_GetTalentLabel() {
return execute_suite<string, int>(
make_test_suite(
"SBF::GetTalentLabel",
make_test_suite("SBF::GetTalentLabel",
GetTalentLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get Acting for id 1",
"Acting",
make_tuple(1)),
make_test<string, int>(
"should get Alertness for id 2",
"Alertness",
make_tuple(2)),
make_test<string, int>(
"should get Athletics for id 3",
"Athletics",
make_tuple(3)),
make_test<string, int>(
"should get Brawl for id 4",
"Brawl",
make_tuple(4)),
make_test<string, int>(
"should get Dodge for id 5",
"Dodge",
make_tuple(5)),
make_test<string, int>(
"should get Empathy for id 6",
"Empathy",
make_tuple(6)),
make_test<string, int>(
"should get Intimidation for id 7",
"Intimidation",
make_tuple(7)),
make_test<string, int>(
"should get Leadership for id 8",
"Leadership",
make_tuple(8)),
make_test<string, int>(
"should get Streetwise for id 9",
"Streetwise",
make_tuple(9)),
make_test<string, int>(
"should get Subterfuge for id 10",
"Subterfuge",
make_tuple(10)),
make_test<string, int>(
"should get and empty string for id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get and empty string for id 11",
"",
make_tuple(11)),
})
)
);
make_test<string, int>("should get Acting for id 1", "Acting", make_tuple(1)),
make_test<string, int>("should get Alertness for id 2", "Alertness", make_tuple(2)),
make_test<string, int>("should get Athletics for id 3", "Athletics", make_tuple(3)),
make_test<string, int>("should get Brawl for id 4", "Brawl", make_tuple(4)),
make_test<string, int>("should get Dodge for id 5", "Dodge", make_tuple(5)),
make_test<string, int>("should get Empathy for id 6", "Empathy", make_tuple(6)),
make_test<string, int>("should get Intimidation for id 7", "Intimidation", make_tuple(7)),
make_test<string, int>("should get Leadership for id 8", "Leadership", make_tuple(8)),
make_test<string, int>("should get Streetwise for id 9", "Streetwise", make_tuple(9)),
make_test<string, int>("should get Subterfuge for id 10", "Subterfuge", make_tuple(10)),
make_test<string, int>("should get and empty string for id 0", "", make_tuple(0)),
make_test<string, int>("should get and empty string for id 11", "", make_tuple(11)),
})));
}
} // End namespace Test::Abilities

View File

@@ -1,4 +1,5 @@
#include "Archetypes.h"
#include <string>
#include <vector>
@@ -17,4 +18,3 @@ namespace SBF {
}
}
} // End namespace SBF

View File

@@ -119,5 +119,6 @@ namespace SBF {
/// @param archetypeLabels The vector to fill.
void FillArchetypeLabels(std::vector<std::string>& archetypeLabels);
} // End namespace SBF
/** @}*/
#endif // End !defined ARCHETYPES_H__

View File

@@ -1,7 +1,9 @@
#include "Archetypes.h"
#include "test.h"
#include <iostream>
#include <sstream>
#include "test.h"
using namespace SBF;
using namespace Test;
using namespace std;
@@ -10,6 +12,7 @@ namespace Test::Archetypes {
TestResults test_GetArchetypeLabel();
TestResults test_FillArchetypeLabels();
} // End namespace Test::Archetypes
using namespace Test::Archetypes;
TestResults main_test_Archetypes(int argc, char** argv) {
@@ -27,136 +30,39 @@ namespace Test::Archetypes {
"SBF::GetArchetypeLabel",
GetArchetypeLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should return \"\" for id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should return \"Architect\" for id 1",
"Architect",
make_tuple(1)),
make_test<string, int>(
"should return \"Autocrat\" for id 2",
"Autocrat",
make_tuple(2)),
make_test<string, int>(
"should return \"Barbarian\" for id 3",
"Barbarian",
make_tuple(3)),
make_test<string, int>(
"should return \"Bon Vivant\" for id 4",
"Bon Vivant",
make_tuple(4)),
make_test<string, int>(
"should return \"Bravo\" for id 5",
"Bravo",
make_tuple(5)),
make_test<string, int>(
"should return \"Caregiver\" for id 6",
"Caregiver",
make_tuple(6)),
make_test<string, int>(
"should return \"Caretaker\" for id 7",
"Caretaker",
make_tuple(7)),
make_test<string, int>(
"should return \"Celebrant\" for id 8",
"Celebrant",
make_tuple(8)),
make_test<string, int>(
"should return \"Child\" for id 9",
"Child",
make_tuple(9)),
make_test<string, int>(
"should return \"Conformist\" for id 10",
"Conformist",
make_tuple(10)),
make_test<string, int>(
"should return \"Conniver\" for id 11",
"Conniver",
make_tuple(11)),
make_test<string, int>(
"should return \"Curmudgeon\" for id 12",
"Curmudgeon",
make_tuple(12)),
make_test<string, int>(
"should return \"Defender\" for id 13",
"Defender",
make_tuple(13)),
make_test<string, int>(
"should return \"Deviant\" for id 14",
"Deviant",
make_tuple(14)),
make_test<string, int>(
"should return \"Director\" for id 15",
"Director",
make_tuple(15)),
make_test<string, int>(
"should return \"Fanatic\" for id 16",
"Fanatic",
make_tuple(16)),
make_test<string, int>(
"should return \"Gallant\" for id 17",
"Gallant",
make_tuple(17)),
make_test<string, int>(
"should return \"Innovator\" for id 18",
"Innovator",
make_tuple(18)),
make_test<string, int>(
"should return \"Jester\" for id 19",
"Jester",
make_tuple(19)),
make_test<string, int>(
"should return \"Judge\" for id 20",
"Judge",
make_tuple(20)),
make_test<string, int>(
"should return \"Loaner\" for id 21",
"Loaner",
make_tuple(21)),
make_test<string, int>(
"should return \"Martyr\" for id 22",
"Martyr",
make_tuple(22)),
make_test<string, int>(
"should return \"Monster\" for id 23",
"Monster",
make_tuple(23)),
make_test<string, int>(
"should return \"Penitent\" for id 24",
"Penitent",
make_tuple(24)),
make_test<string, int>(
"should return \"Rebel\" for id 25",
"Rebel",
make_tuple(25)),
make_test<string, int>(
"should return \"Rogue\" for id 26",
"Rogue",
make_tuple(26)),
make_test<string, int>(
"should return \"Survivor\" for id 27",
"Survivor",
make_tuple(27)),
make_test<string, int>(
"should return \"Traditionalist\" for id 28",
"Traditionalist",
make_tuple(28)),
make_test<string, int>(
"should return \"Tyrant\" for id 29",
"Tyrant",
make_tuple(29)),
make_test<string, int>(
"should return \"Visionary\" for id 30",
"Visionary",
make_tuple(30)),
make_test<string, int>(
"should return \"\" for an invalid id",
"",
make_tuple(31)),
})
));
make_test<string, int>("should return \"\" for id 0", "", make_tuple(0)),
make_test<string, int>("should return \"Architect\" for id 1", "Architect", make_tuple(1)),
make_test<string, int>("should return \"Autocrat\" for id 2", "Autocrat", make_tuple(2)),
make_test<string, int>("should return \"Barbarian\" for id 3", "Barbarian", make_tuple(3)),
make_test<string, int>("should return \"Bon Vivant\" for id 4", "Bon Vivant", make_tuple(4)),
make_test<string, int>("should return \"Bravo\" for id 5", "Bravo", make_tuple(5)),
make_test<string, int>("should return \"Caregiver\" for id 6", "Caregiver", make_tuple(6)),
make_test<string, int>("should return \"Caretaker\" for id 7", "Caretaker", make_tuple(7)),
make_test<string, int>("should return \"Celebrant\" for id 8", "Celebrant", make_tuple(8)),
make_test<string, int>("should return \"Child\" for id 9", "Child", make_tuple(9)),
make_test<string, int>("should return \"Conformist\" for id 10", "Conformist", make_tuple(10)),
make_test<string, int>("should return \"Conniver\" for id 11", "Conniver", make_tuple(11)),
make_test<string, int>("should return \"Curmudgeon\" for id 12", "Curmudgeon", make_tuple(12)),
make_test<string, int>("should return \"Defender\" for id 13", "Defender", make_tuple(13)),
make_test<string, int>("should return \"Deviant\" for id 14", "Deviant", make_tuple(14)),
make_test<string, int>("should return \"Director\" for id 15", "Director", make_tuple(15)),
make_test<string, int>("should return \"Fanatic\" for id 16", "Fanatic", make_tuple(16)),
make_test<string, int>("should return \"Gallant\" for id 17", "Gallant", make_tuple(17)),
make_test<string, int>("should return \"Innovator\" for id 18", "Innovator", make_tuple(18)),
make_test<string, int>("should return \"Jester\" for id 19", "Jester", make_tuple(19)),
make_test<string, int>("should return \"Judge\" for id 20", "Judge", make_tuple(20)),
make_test<string, int>("should return \"Loaner\" for id 21", "Loaner", make_tuple(21)),
make_test<string, int>("should return \"Martyr\" for id 22", "Martyr", make_tuple(22)),
make_test<string, int>("should return \"Monster\" for id 23", "Monster", make_tuple(23)),
make_test<string, int>("should return \"Penitent\" for id 24", "Penitent", make_tuple(24)),
make_test<string, int>("should return \"Rebel\" for id 25", "Rebel", make_tuple(25)),
make_test<string, int>("should return \"Rogue\" for id 26", "Rogue", make_tuple(26)),
make_test<string, int>("should return \"Survivor\" for id 27", "Survivor", make_tuple(27)),
make_test<string, int>("should return \"Traditionalist\" for id 28", "Traditionalist", make_tuple(28)),
make_test<string, int>("should return \"Tyrant\" for id 29", "Tyrant", make_tuple(29)),
make_test<string, int>("should return \"Visionary\" for id 30", "Visionary", make_tuple(30)),
make_test<string, int>("should return \"\" for an invalid id", "", make_tuple(31)),
})));
}
TestResults test_FillArchetypeLabels() {
@@ -164,7 +70,11 @@ namespace Test::Archetypes {
"SBF::FillArchetypeLabels",
[]() -> string {
ostringstream error_message;
vector<string> expected = {"", "Architect", "Autocrat", "Barbarian", "Bon Vivant", "Bravo", "Caregiver", "Caretaker", "Celebrant", "Child", "Conformist", "Conniver", "Curmudgeon", "Defender", "Deviant", "Director", "Fanatic", "Gallant", "Innovator", "Jester", "Judge", "Loaner", "Martyr", "Monster", "Penitent", "Rebel", "Rogue", "Survivor", "Traditionalist", "Tyrant", "Visionary"};
vector<string> expected = {
"", "Architect", "Autocrat", "Barbarian", "Bon Vivant", "Bravo", "Caregiver", "Caretaker",
"Celebrant", "Child", "Conformist", "Conniver", "Curmudgeon", "Defender", "Deviant", "Director",
"Fanatic", "Gallant", "Innovator", "Jester", "Judge", "Loaner", "Martyr", "Monster",
"Penitent", "Rebel", "Rogue", "Survivor", "Traditionalist", "Tyrant", "Visionary"};
vector<string> actual = {"This should be removed."};
FillArchetypeLabels(actual);
compare(error_message, expected, actual);
@@ -175,11 +85,7 @@ namespace Test::Archetypes {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill archetype labels",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill archetype labels", "no errors", make_tuple()),
})));
}
} // End namespace Test::Archetypes

View File

@@ -1,7 +1,8 @@
#include "Attributes.h"
#include <sstream>
#include <string>
#include <vector>
#include <sstream>
namespace SBF {
using std::string;
@@ -137,4 +138,3 @@ void FillMentalAttributeLabels(std::vector<std::string>& labels) {
}
} // End namespace SBF

View File

@@ -171,5 +171,6 @@ namespace SBF {
/// @param labels The vector to fill. It will be cleared first.
void FillMentalAttributeLabels(std::vector<std::string>& labels);
} // End namespace SBF
/** @}*/
#endif // End !defined ATTRIBUTES_H__

View File

@@ -1,9 +1,11 @@
#include "Attributes.h"
#include "test.h"
#include <string>
#include <vector>
#include <tuple>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
#include "test.h"
using namespace SBF;
using namespace Test;
@@ -26,6 +28,7 @@ TestResults test_FillPhysicalAttributeLabels();
TestResults test_FillSocialAttributeLabels();
TestResults test_FillMentalAttributeLabels();
} // End namespace Test::Attributes
using namespace Test::Attributes;
TestResults main_test_Attributes(int argc, char** argv) {
@@ -52,32 +55,16 @@ TestResults main_test_Attributes(int argc, char** argv) {
namespace Test::Attributes {
TestResults test_GetAttributeGroupLabel() {
return execute_suite<string, int>(make_test_suite(
"SBF::GetAttributeGroupLabel",
return execute_suite<string, int>(
make_test_suite("SBF::GetAttributeGroupLabel",
GetAttributeGroupLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get \"\" for id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"Physical\" for id 1",
"Physical",
make_tuple(1)),
make_test<string, int>(
"should get \"Social\" for id 2",
"Social",
make_tuple(2)),
make_test<string, int>(
"should get \"Mental\" for id 3",
"Mental",
make_tuple(3)),
make_test<string, int>(
"should get \"\" for id 4",
"",
make_tuple(4)),
})
));
make_test<string, int>("should get \"\" for id 0", "", make_tuple(0)),
make_test<string, int>("should get \"Physical\" for id 1", "Physical", make_tuple(1)),
make_test<string, int>("should get \"Social\" for id 2", "Social", make_tuple(2)),
make_test<string, int>("should get \"Mental\" for id 3", "Mental", make_tuple(3)),
make_test<string, int>("should get \"\" for id 4", "", make_tuple(4)),
})));
}
TestResults test_GetAttributeLabel() {
@@ -85,60 +72,25 @@ TestResults test_GetAttributeLabel() {
"SBF::GetAttributeLabel",
GetAttributeLabel,
vector<TestTuple<string, int, int>>({
make_test<string, int, int>("should get \"Strength\" for group id 1 and id 1", "Strength", make_tuple(1, 1)),
make_test<string, int, int>(
"should get \"Strength\" for group id 1 and id 1",
"Strength",
make_tuple(1, 1)),
"should get \"Dexterity\" for group id 1 and id 2", "Dexterity", make_tuple(1, 2)),
make_test<string, int, int>("should get \"Stamina\" for group id 1 and id 3", "Stamina", make_tuple(1, 3)),
make_test<string, int, int>("should get \"Charisma\" for group id 2 and id 1", "Charisma", make_tuple(2, 1)),
make_test<string, int, int>(
"should get \"Dexterity\" for group id 1 and id 2",
"Dexterity",
make_tuple(1, 2)),
"should get \"Manipulation\" for group id 2 and id 2", "Manipulation", make_tuple(2, 2)),
make_test<string, int, int>(
"should get \"Stamina\" for group id 1 and id 3",
"Stamina",
make_tuple(1, 3)),
"should get \"Appearance\" for group id 2 and id 3", "Appearance", make_tuple(2, 3)),
make_test<string, int, int>(
"should get \"Charisma\" for group id 2 and id 1",
"Charisma",
make_tuple(2, 1)),
"should get \"Intelligence\" for group id 3 and id 1", "Intelligence", make_tuple(3, 1)),
make_test<string, int, int>(
"should get \"Manipulation\" for group id 2 and id 2",
"Manipulation",
make_tuple(2, 2)),
make_test<string, int, int>(
"should get \"Appearance\" for group id 2 and id 3",
"Appearance",
make_tuple(2, 3)),
make_test<string, int, int>(
"should get \"Intelligence\" for group id 3 and id 1",
"Intelligence",
make_tuple(3, 1)),
make_test<string, int, int>(
"should get \"Perception\" for group id 3 and id 2",
"Perception",
make_tuple(3, 2)),
make_test<string, int, int>(
"should get \"Wits\" for group id 3 and id 3",
"Wits",
make_tuple(3, 3)),
make_test<string, int, int>(
"should get \"\" for an invalid group id 0",
"",
make_tuple(0, 1)),
make_test<string, int, int>(
"should get \"\" for an invalid id 0",
"",
make_tuple(1, 0)),
make_test<string, int, int>(
"should get \"\" for invalid group id 4",
"",
make_tuple(4, 1)),
make_test<string, int, int>(
"should get \"\" for an invalid id 4",
"",
make_tuple(1, 4)),
})
));
"should get \"Perception\" for group id 3 and id 2", "Perception", make_tuple(3, 2)),
make_test<string, int, int>("should get \"Wits\" for group id 3 and id 3", "Wits", make_tuple(3, 3)),
make_test<string, int, int>("should get \"\" for an invalid group id 0", "", make_tuple(0, 1)),
make_test<string, int, int>("should get \"\" for an invalid id 0", "", make_tuple(1, 0)),
make_test<string, int, int>("should get \"\" for invalid group id 4", "", make_tuple(4, 1)),
make_test<string, int, int>("should get \"\" for an invalid id 4", "", make_tuple(1, 4)),
})));
}
TestResults test_GetAttributeLabelAbbreviation() {
@@ -146,263 +98,111 @@ TestResults test_GetAttributeLabelAbbreviation() {
"SBF::GetAttributeLabelAbbreviation",
GetAttributeLabelAbbreviation,
vector<TestTuple<string, int, int>>({
make_test<string, int, int>(
"should get \"Str.\" for group id 1 and id 1",
"Str.",
make_tuple(1, 1)),
make_test<string, int, int>(
"should get \"Dex.\" for group id 1 and id 2",
"Dex.",
make_tuple(1, 2)),
make_test<string, int, int>(
"should get \"Sta.\" for group id 1 and id 3",
"Sta.",
make_tuple(1, 3)),
make_test<string, int, int>(
"should get \"Cha.\" for group id 2 and id 1",
"Cha.",
make_tuple(2, 1)),
make_test<string, int, int>(
"should get \"Man.\" for group id 2 and id 2",
"Man.",
make_tuple(2, 2)),
make_test<string, int, int>(
"should get \"App.\" for group id 2 and id 3",
"App.",
make_tuple(2, 3)),
make_test<string, int, int>(
"should get \"Int.\" for group id 3 and id 1",
"Int.",
make_tuple(3, 1)),
make_test<string, int, int>(
"should get \"Per.\" for group id 3 and id 2",
"Per.",
make_tuple(3, 2)),
make_test<string, int, int>(
"should get \"Wits\" for group id 3 and id 3",
"Wits",
make_tuple(3, 3)),
make_test<string, int, int>(
"should get \"\" for an invalid group id 0",
"",
make_tuple(0, 1)),
make_test<string, int, int>(
"should get \"\" for an invalid id 0",
"",
make_tuple(1, 0)),
make_test<string, int, int>(
"should get \"\" for invalid group id 4",
"",
make_tuple(4, 1)),
make_test<string, int, int>(
"should get \"\" for an invalid id 4",
"",
make_tuple(1, 4)),
})
));
make_test<string, int, int>("should get \"Str.\" for group id 1 and id 1", "Str.", make_tuple(1, 1)),
make_test<string, int, int>("should get \"Dex.\" for group id 1 and id 2", "Dex.", make_tuple(1, 2)),
make_test<string, int, int>("should get \"Sta.\" for group id 1 and id 3", "Sta.", make_tuple(1, 3)),
make_test<string, int, int>("should get \"Cha.\" for group id 2 and id 1", "Cha.", make_tuple(2, 1)),
make_test<string, int, int>("should get \"Man.\" for group id 2 and id 2", "Man.", make_tuple(2, 2)),
make_test<string, int, int>("should get \"App.\" for group id 2 and id 3", "App.", make_tuple(2, 3)),
make_test<string, int, int>("should get \"Int.\" for group id 3 and id 1", "Int.", make_tuple(3, 1)),
make_test<string, int, int>("should get \"Per.\" for group id 3 and id 2", "Per.", make_tuple(3, 2)),
make_test<string, int, int>("should get \"Wits\" for group id 3 and id 3", "Wits", make_tuple(3, 3)),
make_test<string, int, int>("should get \"\" for an invalid group id 0", "", make_tuple(0, 1)),
make_test<string, int, int>("should get \"\" for an invalid id 0", "", make_tuple(1, 0)),
make_test<string, int, int>("should get \"\" for invalid group id 4", "", make_tuple(4, 1)),
make_test<string, int, int>("should get \"\" for an invalid id 4", "", make_tuple(1, 4)),
})));
}
TestResults test_GetPhysicalAttributeLabel() {
return execute_suite<string, int>(make_test_suite(
"SBF::GetPhysicalAttributeLabel",
return execute_suite<string, int>(
make_test_suite("SBF::GetPhysicalAttributeLabel",
GetPhysicalAttributeLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get \"Strength\" for id 1",
"Strength",
make_tuple(1)),
make_test<string, int>(
"should get \"Dexterity\" for id 2",
"Dexterity",
make_tuple(2)),
make_test<string, int>(
"should get \"Stamina\" for id 3",
"Stamina",
make_tuple(3)),
make_test<string, int>(
"should get \"\" for invalid id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"\" for invalid id 4",
"",
make_tuple(4)),
})
));
make_test<string, int>("should get \"Strength\" for id 1", "Strength", make_tuple(1)),
make_test<string, int>("should get \"Dexterity\" for id 2", "Dexterity", make_tuple(2)),
make_test<string, int>("should get \"Stamina\" for id 3", "Stamina", make_tuple(3)),
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
})));
}
TestResults test_GetPhysicalAttributeLabelAbbreviation() {
return execute_suite<string, int>(make_test_suite(
"SBF::GetPhysicalAttributeLabelAbbreviation",
return execute_suite<string, int>(
make_test_suite("SBF::GetPhysicalAttributeLabelAbbreviation",
GetPhysicalAttributeLabelAbbreviation,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get \"Str.\" for id 1",
"Str.",
make_tuple(1)),
make_test<string, int>(
"should get \"Dex.\" for id 2",
"Dex.",
make_tuple(2)),
make_test<string, int>(
"should get \"Sta.\" for id 3",
"Sta.",
make_tuple(3)),
make_test<string, int>(
"should get \"\" for invalid id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"\" for invalid id 4",
"",
make_tuple(4)),
})
));
make_test<string, int>("should get \"Str.\" for id 1", "Str.", make_tuple(1)),
make_test<string, int>("should get \"Dex.\" for id 2", "Dex.", make_tuple(2)),
make_test<string, int>("should get \"Sta.\" for id 3", "Sta.", make_tuple(3)),
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
})));
}
TestResults test_GetSocialAttributeLabel() {
return execute_suite<string, int>(make_test_suite(
"SBF::GetSocialAttributeLabel",
return execute_suite<string, int>(
make_test_suite("SBF::GetSocialAttributeLabel",
GetSocialAttributeLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get \"Charisma\" for id 1",
"Charisma",
make_tuple(1)),
make_test<string, int>(
"should get \"Manipulation\" for id 2",
"Manipulation",
make_tuple(2)),
make_test<string, int>(
"should get \"Appearance\" for id 3",
"Appearance",
make_tuple(3)),
make_test<string, int>(
"should get \"\" for invalid id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"\" for invalid id 4",
"",
make_tuple(4)),
})
));
make_test<string, int>("should get \"Charisma\" for id 1", "Charisma", make_tuple(1)),
make_test<string, int>("should get \"Manipulation\" for id 2", "Manipulation", make_tuple(2)),
make_test<string, int>("should get \"Appearance\" for id 3", "Appearance", make_tuple(3)),
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
})));
}
TestResults test_GetSocialAttributeLabelAbbreviation() {
return execute_suite<string, int>(make_test_suite(
"SBF::GetSocialAttributeLabelAbbreviation",
return execute_suite<string, int>(
make_test_suite("SBF::GetSocialAttributeLabelAbbreviation",
GetSocialAttributeLabelAbbreviation,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get \"Cha.\" for id 1",
"Cha.",
make_tuple(1)),
make_test<string, int>(
"should get \"Man.\" for id 2",
"Man.",
make_tuple(2)),
make_test<string, int>(
"should get \"App.\" for id 3",
"App.",
make_tuple(3)),
make_test<string, int>(
"should get \"\" for invalid id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"\" for invalid id 4",
"",
make_tuple(4)),
})
));
make_test<string, int>("should get \"Cha.\" for id 1", "Cha.", make_tuple(1)),
make_test<string, int>("should get \"Man.\" for id 2", "Man.", make_tuple(2)),
make_test<string, int>("should get \"App.\" for id 3", "App.", make_tuple(3)),
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
})));
}
TestResults test_GetMentalAttributeLabel() {
return execute_suite<string, int>(make_test_suite(
"SBF::GetMentalAttributeLabel",
return execute_suite<string, int>(
make_test_suite("SBF::GetMentalAttributeLabel",
GetMentalAttributeLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get \"Intelligence\" for id 1",
"Intelligence",
make_tuple(1)),
make_test<string, int>(
"should get \"Perception\" for id 2",
"Perception",
make_tuple(2)),
make_test<string, int>(
"should get \"Wits\" for id 3",
"Wits",
make_tuple(3)),
make_test<string, int>(
"should get \"\" for invalid id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"\" for invalid id 4",
"",
make_tuple(4)),
})
));
make_test<string, int>("should get \"Intelligence\" for id 1", "Intelligence", make_tuple(1)),
make_test<string, int>("should get \"Perception\" for id 2", "Perception", make_tuple(2)),
make_test<string, int>("should get \"Wits\" for id 3", "Wits", make_tuple(3)),
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
})));
}
TestResults test_GetMentalAttributeLabelAbbreviation() {
return execute_suite<string, int>(make_test_suite(
"SBF::GetMentalAttributeLabelAbbreviation",
return execute_suite<string, int>(
make_test_suite("SBF::GetMentalAttributeLabelAbbreviation",
GetMentalAttributeLabelAbbreviation,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get \"Int.\" for id 1",
"Int.",
make_tuple(1)),
make_test<string, int>(
"should get \"Per.\" for id 2",
"Per.",
make_tuple(2)),
make_test<string, int>(
"should get \"Wits\" for id 3",
"Wits",
make_tuple(3)),
make_test<string, int>(
"should get \"\" for invalid id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"\" for invalid id 4",
"",
make_tuple(4)),
})
));
make_test<string, int>("should get \"Int.\" for id 1", "Int.", make_tuple(1)),
make_test<string, int>("should get \"Per.\" for id 2", "Per.", make_tuple(2)),
make_test<string, int>("should get \"Wits\" for id 3", "Wits", make_tuple(3)),
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
})));
}
TestResults test_GetNumAttributesInGroup() {
return execute_suite<int, int>(make_test_suite(
"SBF::GetNumAttributesInGroup",
return execute_suite<int, int>(
make_test_suite("SBF::GetNumAttributesInGroup",
GetNumAttributesInGroup,
vector<TestTuple<int, int>>({
make_test<int, int>(
"should get 0 for invalid group 0",
0,
make_tuple(0)),
make_test<int, int>(
"should get 3 for group 1 kAttributeGroupPhysicalId",
3,
make_tuple(1)),
make_test<int, int>(
"should get 3 for group 2 kAttributeGropuSocialId",
3,
make_tuple(2)),
make_test<int, int>(
"should get 3 for group 3 kAttributeGroupMentalId",
3,
make_tuple(3)),
make_test<int, int>(
"should get 0 for invalid group 4",
0,
make_tuple(4)),
})
));
make_test<int, int>("should get 0 for invalid group 0", 0, make_tuple(0)),
make_test<int, int>("should get 3 for group 1 kAttributeGroupPhysicalId", 3, make_tuple(1)),
make_test<int, int>("should get 3 for group 2 kAttributeGropuSocialId", 3, make_tuple(2)),
make_test<int, int>("should get 3 for group 3 kAttributeGroupMentalId", 3, make_tuple(3)),
make_test<int, int>("should get 0 for invalid group 4", 0, make_tuple(4)),
})));
}
TestResults test_FillAttributeGroupLabels() {
@@ -421,13 +221,10 @@ TestResults test_FillAttributeGroupLabels() {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill attribute group labels",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill attribute group labels", "no errors", make_tuple()),
})));
}
// void FillAttributeLabelInGroup(std::vector<std::string> attributeLabels);
TestResults test_FillAttributeLabelsInGroup() {
return execute_suite<string, int, vector<string>>(make_test_suite(
@@ -445,9 +242,7 @@ TestResults test_FillAttributeLabelsInGroup() {
},
vector<TestTuple<string, int, vector<string>>>({
make_test<string, int, vector<string>>(
"should fill an empty list for invalid group 0",
"no errors",
make_tuple(0, vector<string>({}))),
"should fill an empty list for invalid group 0", "no errors", make_tuple(0, vector<string>({}))),
make_test<string, int, vector<string>>(
"should fill physical attribute labels for group 1 kAttributeGropuPhysicalId",
"no errors",
@@ -461,11 +256,8 @@ TestResults test_FillAttributeLabelsInGroup() {
"no errors",
make_tuple(3, vector<string>({"Intelligence", "Perception", "Wits"}))),
make_test<string, int, vector<string>>(
"should fill an empty list for invalid group 4",
"no errors",
make_tuple(4, vector<string>({}))),
})
));
"should fill an empty list for invalid group 4", "no errors", make_tuple(4, vector<string>({}))),
})));
}
TestResults test_FillPhysicalAttributeLabels() {
@@ -484,13 +276,10 @@ TestResults test_FillPhysicalAttributeLabels() {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill physical attribute labels",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill physical attribute labels", "no errors", make_tuple()),
})));
}
// void FillSocialAttributeLabels(std::vector<std::string> socialAttributeLabels);
TestResults test_FillSocialAttributeLabels() {
return execute_suite<string>(make_test_suite(
@@ -508,13 +297,10 @@ TestResults test_FillSocialAttributeLabels() {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill social attribute labels",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill social attribute labels", "no errors", make_tuple()),
})));
}
// void FillMentalAttributeLabels(std::vector<std::string> mentalAttributeLabels);
TestResults test_FillMentalAttributeLabels() {
return execute_suite<string>(make_test_suite(
@@ -532,11 +318,7 @@ TestResults test_FillMentalAttributeLabels() {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill mental attribute labels",
"no errors",
make_tuple()),
})
));
}
make_test<string>("should fill mental attribute labels", "no errors", make_tuple()),
})));
}
} // namespace Test::Attributes

View File

@@ -1,4 +1,5 @@
#include "Backgrounds.h"
#include <string>
#include <vector>

View File

@@ -60,5 +60,6 @@ namespace SBF {
/// @param background_labels The vector to fill. It will be emptied first.
void FillBackgroundLabels(std::vector<std::string>& background_labels);
} // End namespace SBF
/** @}*/
#endif // End !defined BACKGROUNDS_H__

View File

@@ -1,9 +1,11 @@
#include "Backgrounds.h"
#include "test.h"
#include <string>
#include <vector>
#include <tuple>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
#include "test.h"
using namespace SBF;
using namespace Test;
@@ -12,7 +14,8 @@ using namespace std;
namespace Test::Backgrounds {
TestResults test_GetBackgroundLabel();
TestResults test_FillBackgroundLabels();
} // End namespace Test::Attributes
} // namespace Test::Backgrounds
using namespace Test::Backgrounds;
TestResults main_test_Backgrounds(int argc, char** argv) {
@@ -30,56 +33,27 @@ TestResults test_GetBackgroundLabel() {
"SBF::GetBackgroundLabel",
GetBackgroundLabel,
vector<TestTuple<string, int>>({
make_test<string, int>("should get \"\" for invalid background 0", "", make_tuple(0)),
make_test<string, int>(
"should get \"\" for invalid background 0",
"",
make_tuple(0)),
"should get \"Allies\" for background 1 kBackgroundAlliesLabel", "Allies", make_tuple(1)),
make_test<string, int>(
"should get \"Allies\" for background 1 kBackgroundAlliesLabel",
"Allies",
make_tuple(1)),
"should get \"Contacts\" for background 2 kBackgroundContactsLabel", "Contacts", make_tuple(2)),
make_test<string, int>("should get \"Fame\" for background 3 kBackgroundFameLabel", "Fame", make_tuple(3)),
make_test<string, int>(
"should get \"Contacts\" for background 2 kBackgroundContactsLabel",
"Contacts",
make_tuple(2)),
"should get \"Generation\" for background 4 kBackgroundGenerationLabel", "Generation", make_tuple(4)),
make_test<string, int>("should get \"Herd\" for background 5 kBackgroundHerdLabel", "Herd", make_tuple(5)),
make_test<string, int>(
"should get \"Fame\" for background 3 kBackgroundFameLabel",
"Fame",
make_tuple(3)),
"should get \"Influence\" for background 6 kBackgroundInfluenceLabel", "Influence", make_tuple(6)),
make_test<string, int>(
"should get \"Generation\" for background 4 kBackgroundGenerationLabel",
"Generation",
make_tuple(4)),
"should get \"Mentor\" for background 7 kBackgroundMentorLabel", "Mentor", make_tuple(7)),
make_test<string, int>(
"should get \"Herd\" for background 5 kBackgroundHerdLabel",
"Herd",
make_tuple(5)),
"should get \"Resources\" for background 8 kBackgroundResourcesLabel", "Resources", make_tuple(8)),
make_test<string, int>(
"should get \"Influence\" for background 6 kBackgroundInfluenceLabel",
"Influence",
make_tuple(6)),
"should get \"Retainers\" for background 9 kBackgroundRetainersLabel", "Retainers", make_tuple(9)),
make_test<string, int>(
"should get \"Mentor\" for background 7 kBackgroundMentorLabel",
"Mentor",
make_tuple(7)),
make_test<string, int>(
"should get \"Resources\" for background 8 kBackgroundResourcesLabel",
"Resources",
make_tuple(8)),
make_test<string, int>(
"should get \"Retainers\" for background 9 kBackgroundRetainersLabel",
"Retainers",
make_tuple(9)),
make_test<string, int>(
"should get \"Status\" for background 10 kBackgroundStatusLabel",
"Status",
make_tuple(10)),
make_test<string, int>(
"should get \"\" for invalid background 11",
"",
make_tuple(11)),
})
));
"should get \"Status\" for background 10 kBackgroundStatusLabel", "Status", make_tuple(10)),
make_test<string, int>("should get \"\" for invalid background 11", "", make_tuple(11)),
})));
}
TestResults test_FillBackgroundLabels() {
@@ -87,7 +61,16 @@ TestResults test_FillBackgroundLabels() {
"SBF::FillBackgroundLabels",
[]() -> string {
ostringstream error_message;
vector<string> expected = {"Allies", "Contacts", "Fame", "Generation", "Herd", "Influence", "Mentor", "Resources", "Retainers", "Status" };
vector<string> expected = {"Allies",
"Contacts",
"Fame",
"Generation",
"Herd",
"Influence",
"Mentor",
"Resources",
"Retainers",
"Status"};
vector<string> actual = {"This should be removed."};
FillBackgroundLabels(actual);
compare(error_message, expected, actual);
@@ -98,10 +81,7 @@ TestResults test_FillBackgroundLabels() {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill background labels",
"no errors",
make_tuple()),
make_test<string>("should fill background labels", "no errors", make_tuple()),
})
));

View File

@@ -461,7 +461,6 @@ namespace SBF {
case kTalentSubterfugeId:
talent_subterfuge = value;
break;
}
}
@@ -710,4 +709,3 @@ namespace SBF {
}
}
} // End namespace SBF

View File

@@ -8,18 +8,19 @@
* Copyright 2023 Tom Hicks
* Licensed under the MIT license see the LICENSE file for details.
***************************************************************************************/
#include "Colors.h"
#include "Ranks.h"
#include <cstdint>
#include <string>
#include <vector>
#include "Abilities.h"
#include "Attributes.h"
#include "Backgrounds.h"
#include "Clans.h"
#include "Colors.h"
#include "Derangements.h"
#include "Disciplines.h"
#include "Ranks.h"
#include "Virtues.h"
#include "Attributes.h"
#include "Abilities.h"
#include "Backgrounds.h"
#include <string>
#include <cstdint>
#include <vector>
/** \addtogroup Character
* @{

View File

@@ -1,4 +1,5 @@
#include "Character.h"
#include "test.h"
using namespace SBF;
using namespace Test;

View File

@@ -1,4 +1,5 @@
#include "Clans.h"
#include <string>
#include <vector>

View File

@@ -83,5 +83,6 @@ namespace SBF {
/// @param clans The vector to fill. It will be emptied first.
void FillClanLabels(std::vector<std::string>& clans);
} // End namespace SBF
/** @}*/
#endif // End !defined CLANS_H__

View File

@@ -1,9 +1,11 @@
#include "Clans.h"
#include "test.h"
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
#include <sstream>
#include "test.h"
using namespace SBF;
using namespace Test;
@@ -13,6 +15,7 @@ namespace Test::Clans {
TestResults test_GetClanLabel();
TestResults test_FillClanLabels();
} // End namespace Test::Clans
using namespace Test::Clans;
TestResults main_test_Clans(int argc, char** argv) {
@@ -30,88 +33,28 @@ TestResults test_GetClanLabel() {
"SBF::GetClanLabel",
GetClanLabel,
vector<TestTuple<string, int>>({
make_test<string, int>("should get \"\" for invalid clan 0", "", make_tuple(0)),
make_test<string, int>("should get \"Anarch\" for clan 1 kClanAnarch", "Anarch", make_tuple(1)),
make_test<string, int>("should get \"Assamite\" for clan 2 kClanAssamite", "Assamite", make_tuple(2)),
make_test<string, int>("should get \"Baali\" for clan 3 kClanBaali", "Baali", make_tuple(3)),
make_test<string, int>("should get \"Brujah\" for clan 4 kClanBrujah", "Brujah", make_tuple(4)),
make_test<string, int>("should get \"Caitiff\" for clan 5 kClanCaitiff", "Caitiff", make_tuple(5)),
make_test<string, int>(
"should get \"\" for invalid clan 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"Anarch\" for clan 1 kClanAnarch",
"Anarch",
make_tuple(1)),
make_test<string, int>(
"should get \"Assamite\" for clan 2 kClanAssamite",
"Assamite",
make_tuple(2)),
make_test<string, int>(
"should get \"Baali\" for clan 3 kClanBaali",
"Baali",
make_tuple(3)),
make_test<string, int>(
"should get \"Brujah\" for clan 4 kClanBrujah",
"Brujah",
make_tuple(4)),
make_test<string, int>(
"should get \"Caitiff\" for clan 5 kClanCaitiff",
"Caitiff",
make_tuple(5)),
make_test<string, int>(
"should get \"Cappadocian\" for clan 6 kClanCappadocian",
"Cappadocian",
make_tuple(6)),
make_test<string, int>(
"should get \"Gangrel\" for clan 7 kClanGangrel",
"Gangrel",
make_tuple(7)),
make_test<string, int>(
"should get \"Giovanni\" for clan 8 kClanGiovanni",
"Giovanni",
make_tuple(8)),
make_test<string, int>(
"should get \"Inconnu\" for clan 9 kClanInconnu",
"Inconnu",
make_tuple(9)),
make_test<string, int>(
"should get \"Lasombra\" for clan 10 kClanLasombra",
"Lasombra",
make_tuple(10)),
make_test<string, int>(
"should get \"Malkavian\" for clan 11 kClanMalkavian",
"Malkavian",
make_tuple(11)),
make_test<string, int>(
"should get \"Nosferatu\" for clan 12 kClanNosferatu",
"Nosferatu",
make_tuple(12)),
make_test<string, int>(
"should get \"Ravanos\" for clan 13 kClanRavanos",
"Ravanos",
make_tuple(13)),
make_test<string, int>(
"should get \"Settite\" for clan 14 kClanSettite",
"Settite",
make_tuple(14)),
make_test<string, int>(
"should get \"Toreador\" for clan 15 kClanToreador",
"Toreador",
make_tuple(15)),
make_test<string, int>(
"should get \"Tremere\" for clan 16 kClanTremere",
"Tremere",
make_tuple(16)),
make_test<string, int>(
"should get \"Tzismice\" for clan 17 kClanTzismice",
"Tzismice",
make_tuple(17)),
make_test<string, int>(
"should get \"Ventrue\" for clan 18 kClanVentrue",
"Ventrue",
make_tuple(18)),
make_test<string, int>(
"should get \"\" for invalid clan 19",
"",
make_tuple(19)),
})
));
"should get \"Cappadocian\" for clan 6 kClanCappadocian", "Cappadocian", make_tuple(6)),
make_test<string, int>("should get \"Gangrel\" for clan 7 kClanGangrel", "Gangrel", make_tuple(7)),
make_test<string, int>("should get \"Giovanni\" for clan 8 kClanGiovanni", "Giovanni", make_tuple(8)),
make_test<string, int>("should get \"Inconnu\" for clan 9 kClanInconnu", "Inconnu", make_tuple(9)),
make_test<string, int>("should get \"Lasombra\" for clan 10 kClanLasombra", "Lasombra", make_tuple(10)),
make_test<string, int>("should get \"Malkavian\" for clan 11 kClanMalkavian", "Malkavian", make_tuple(11)),
make_test<string, int>("should get \"Nosferatu\" for clan 12 kClanNosferatu", "Nosferatu", make_tuple(12)),
make_test<string, int>("should get \"Ravanos\" for clan 13 kClanRavanos", "Ravanos", make_tuple(13)),
make_test<string, int>("should get \"Settite\" for clan 14 kClanSettite", "Settite", make_tuple(14)),
make_test<string, int>("should get \"Toreador\" for clan 15 kClanToreador", "Toreador", make_tuple(15)),
make_test<string, int>("should get \"Tremere\" for clan 16 kClanTremere", "Tremere", make_tuple(16)),
make_test<string, int>("should get \"Tzismice\" for clan 17 kClanTzismice", "Tzismice", make_tuple(17)),
make_test<string, int>("should get \"Ventrue\" for clan 18 kClanVentrue", "Ventrue", make_tuple(18)),
make_test<string, int>("should get \"\" for invalid clan 19", "", make_tuple(19)),
})));
}
TestResults test_FillClanLabels() {
@@ -119,7 +62,24 @@ TestResults test_FillClanLabels() {
"SBF::FillClanLabels",
[]() -> string {
ostringstream error_message;
vector<string> expected = {"Anarch", "Assamite", "Baali", "Brujah", "Caitiff", "Cappadocian", "Gangrel", "Giovanni", "Inconnu", "Lasombra", "Malkavian", "Nosferatu", "Ravanos", "Settite", "Toreador", "Tremere", "Tzismice", "Ventrue"};
vector<string> expected = {"Anarch",
"Assamite",
"Baali",
"Brujah",
"Caitiff",
"Cappadocian",
"Gangrel",
"Giovanni",
"Inconnu",
"Lasombra",
"Malkavian",
"Nosferatu",
"Ravanos",
"Settite",
"Toreador",
"Tremere",
"Tzismice",
"Ventrue"};
vector<string> actual = {"This should be removed."};
FillClanLabels(actual);
compare(error_message, expected, actual);
@@ -130,10 +90,7 @@ TestResults test_FillClanLabels() {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill clan labels",
"no errors",
make_tuple()),
make_test<string>("should fill clan labels", "no errors", make_tuple()),
})
));

View File

@@ -54,5 +54,6 @@ namespace SBF {
/// @param colors The vector to fill.
void FillColors(std::vector<uint8_t>& colors);
} // End namespace SBF
/** @}*/
#endif // End !defined COLORS_H__

View File

@@ -1,9 +1,11 @@
#include "Colors.h"
#include "test.h"
#include <string>
#include <tuple>
#include <vector>
#include "test.h"
using namespace SBF;
using namespace Test;
using namespace std;
@@ -15,11 +17,14 @@ TestResults test_GetForegroundColor();
TestResults test_SetBackgroundColor();
TestResults test_SetForegroundColor();
} // End namespace Test::Colors
using namespace Test::Colors;
namespace SBF {
extern uint8_t g_foregroundColor;
extern uint8_t g_backgroundColor;
}
} // namespace SBF
TestResults main_test_Colors(int argc, char** argv) {
TestResults results;
@@ -31,6 +36,7 @@ TestResults main_test_Colors(int argc, char** argv) {
return results;
}
namespace Test::Colors {
TestResults test_FillColors() {
return execute_suite<string>(make_test_suite(
@@ -48,12 +54,8 @@ TestResults test_FillColors() {
return "no errors";
},
vector<TestTuple<string>>({
make_test<string>(
"should fill colors",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill colors", "no errors", make_tuple()),
})));
}
TestResults test_GetBackgroundColor() {
@@ -66,79 +68,42 @@ TestResults test_GetBackgroundColor() {
fnToTest,
vector<TestTuple<uint32_t, uint32_t>>({
make_test<uint32_t, uint32_t>(
"should get kColorDarkBlack when background color is 0",
kColorDarkBlack,
make_tuple(0U)),
"should get kColorDarkBlack when background color is 0", kColorDarkBlack, make_tuple(0U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkBlue when background color is 1",
kColorDarkBlue,
make_tuple(1U)),
"should get kColorDarkBlue when background color is 1", kColorDarkBlue, make_tuple(1U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkGreen when background color is 2",
kColorDarkGreen,
make_tuple(2U)),
"should get kColorDarkGreen when background color is 2", kColorDarkGreen, make_tuple(2U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkCyan when background color is 3",
kColorDarkCyan,
make_tuple(3U)),
"should get kColorDarkCyan when background color is 3", kColorDarkCyan, make_tuple(3U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkRed when background color is 4",
kColorDarkRed,
make_tuple(4U)),
"should get kColorDarkRed when background color is 4", kColorDarkRed, make_tuple(4U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkMagenta when background color is 5",
kColorDarkMagenta,
make_tuple(5U)),
"should get kColorDarkMagenta when background color is 5", kColorDarkMagenta, make_tuple(5U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkOrange when background color is 6",
kColorDarkOrange,
make_tuple(6U)),
"should get kColorDarkOrange when background color is 6", kColorDarkOrange, make_tuple(6U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkYellow when background color is 6",
kColorDarkYellow,
make_tuple(6U)),
"should get kColorDarkYellow when background color is 6", kColorDarkYellow, make_tuple(6U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkWhite when background color is 7",
kColorDarkWhite,
make_tuple(7U)),
"should get kColorDarkWhite when background color is 7", kColorDarkWhite, make_tuple(7U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightBlack when background color is 8",
kColorBrightBlack,
make_tuple(8U)),
"should get kColorBrightBlack when background color is 8", kColorBrightBlack, make_tuple(8U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightBlue when background color is 9",
kColorBrightBlue,
make_tuple(9U)),
"should get kColorBrightBlue when background color is 9", kColorBrightBlue, make_tuple(9U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightGreen when background color is 10",
kColorBrightGreen,
make_tuple(10U)),
"should get kColorBrightGreen when background color is 10", kColorBrightGreen, make_tuple(10U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightCyan when background color is 11",
kColorBrightCyan,
make_tuple(11U)),
"should get kColorBrightCyan when background color is 11", kColorBrightCyan, make_tuple(11U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightRed when background color is 12",
kColorBrightRed,
make_tuple(12U)),
"should get kColorBrightRed when background color is 12", kColorBrightRed, make_tuple(12U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightMagenta when background color is 13",
kColorBrightMagenta,
make_tuple(13U)),
"should get kColorBrightMagenta when background color is 13", kColorBrightMagenta, make_tuple(13U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightOrange when background color is 14",
kColorBrightOrange,
make_tuple(14U)),
"should get kColorBrightOrange when background color is 14", kColorBrightOrange, make_tuple(14U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightYellow when background color is 14",
kColorBrightYellow,
make_tuple(14U)),
"should get kColorBrightYellow when background color is 14", kColorBrightYellow, make_tuple(14U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightWhite when background color is 15",
kColorBrightWhite,
make_tuple(15U)),
})
));
"should get kColorBrightWhite when background color is 15", kColorBrightWhite, make_tuple(15U)),
})));
}
TestResults test_GetForegroundColor() {
@@ -151,79 +116,42 @@ TestResults test_GetForegroundColor() {
fnToTest,
vector<TestTuple<uint32_t, uint32_t>>({
make_test<uint32_t, uint32_t>(
"should get kColorDarkBlack when foreground color is 0",
kColorDarkBlack,
make_tuple(0U)),
"should get kColorDarkBlack when foreground color is 0", kColorDarkBlack, make_tuple(0U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkBlue when foreground color is 1",
kColorDarkBlue,
make_tuple(1U)),
"should get kColorDarkBlue when foreground color is 1", kColorDarkBlue, make_tuple(1U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkGreen when foreground color is 2",
kColorDarkGreen,
make_tuple(2U)),
"should get kColorDarkGreen when foreground color is 2", kColorDarkGreen, make_tuple(2U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkCyan when foreground color is 3",
kColorDarkCyan,
make_tuple(3U)),
"should get kColorDarkCyan when foreground color is 3", kColorDarkCyan, make_tuple(3U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkRed when foreground color is 4",
kColorDarkRed,
make_tuple(4U)),
"should get kColorDarkRed when foreground color is 4", kColorDarkRed, make_tuple(4U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkMagenta when foreground color is 5",
kColorDarkMagenta,
make_tuple(5U)),
"should get kColorDarkMagenta when foreground color is 5", kColorDarkMagenta, make_tuple(5U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkOrange when foreground color is 6",
kColorDarkOrange,
make_tuple(6U)),
"should get kColorDarkOrange when foreground color is 6", kColorDarkOrange, make_tuple(6U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkYellow when foreground color is 6",
kColorDarkYellow,
make_tuple(6U)),
"should get kColorDarkYellow when foreground color is 6", kColorDarkYellow, make_tuple(6U)),
make_test<uint32_t, uint32_t>(
"should get kColorDarkWhite when foreground color is 7",
kColorDarkWhite,
make_tuple(7U)),
"should get kColorDarkWhite when foreground color is 7", kColorDarkWhite, make_tuple(7U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightBlack when foreground color is 8",
kColorBrightBlack,
make_tuple(8U)),
"should get kColorBrightBlack when foreground color is 8", kColorBrightBlack, make_tuple(8U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightBlue when foreground color is 9",
kColorBrightBlue,
make_tuple(9U)),
"should get kColorBrightBlue when foreground color is 9", kColorBrightBlue, make_tuple(9U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightGreen when foreground color is 10",
kColorBrightGreen,
make_tuple(10U)),
"should get kColorBrightGreen when foreground color is 10", kColorBrightGreen, make_tuple(10U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightCyan when foreground color is 11",
kColorBrightCyan,
make_tuple(11U)),
"should get kColorBrightCyan when foreground color is 11", kColorBrightCyan, make_tuple(11U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightRed when foreground color is 12",
kColorBrightRed,
make_tuple(12U)),
"should get kColorBrightRed when foreground color is 12", kColorBrightRed, make_tuple(12U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightMagenta when foreground color is 13",
kColorBrightMagenta,
make_tuple(13U)),
"should get kColorBrightMagenta when foreground color is 13", kColorBrightMagenta, make_tuple(13U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightOrange when foreground color is 14",
kColorBrightOrange,
make_tuple(14U)),
"should get kColorBrightOrange when foreground color is 14", kColorBrightOrange, make_tuple(14U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightYellow when foreground color is 14",
kColorBrightYellow,
make_tuple(14U)),
"should get kColorBrightYellow when foreground color is 14", kColorBrightYellow, make_tuple(14U)),
make_test<uint32_t, uint32_t>(
"should get kColorBrightWhite when foreground color is 15",
kColorBrightWhite,
make_tuple(15U)),
})
));
"should get kColorBrightWhite when foreground color is 15", kColorBrightWhite, make_tuple(15U)),
})));
}
TestResults test_SetBackgroundColor() {
@@ -237,79 +165,45 @@ TestResults test_SetBackgroundColor() {
fnToTest,
vector<TestTuple<uint32_t, uint32_t>>({
make_test<uint32_t, uint32_t>(
"should set background color to kColorDarkBlack when color is 0",
kColorDarkBlack,
make_tuple(0U)),
"should set background color to kColorDarkBlack when color is 0", kColorDarkBlack, make_tuple(0U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorDarkBlue when color is 1",
kColorDarkBlue,
make_tuple(1U)),
"should set background color to kColorDarkBlue when color is 1", kColorDarkBlue, make_tuple(1U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorDarkGreen when color is 2",
kColorDarkGreen,
make_tuple(2U)),
"should set background color to kColorDarkGreen when color is 2", kColorDarkGreen, make_tuple(2U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorDarkCyan when color is 3",
kColorDarkCyan,
make_tuple(3U)),
"should set background color to kColorDarkCyan when color is 3", kColorDarkCyan, make_tuple(3U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorDarkRed when color is 4",
kColorDarkRed,
make_tuple(4U)),
"should set background color to kColorDarkRed when color is 4", kColorDarkRed, make_tuple(4U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorDarkMagenta when color is 5",
kColorDarkMagenta,
make_tuple(5U)),
"should set background color to kColorDarkMagenta when color is 5", kColorDarkMagenta, make_tuple(5U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorDarkOrange when color is 6",
kColorDarkOrange,
make_tuple(6U)),
"should set background color to kColorDarkOrange when color is 6", kColorDarkOrange, make_tuple(6U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorDarkYellow when color is 6",
kColorDarkYellow,
make_tuple(6U)),
"should set background color to kColorDarkYellow when color is 6", kColorDarkYellow, make_tuple(6U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorDarkWhite when color is 7",
kColorDarkWhite,
make_tuple(7U)),
"should set background color to kColorDarkWhite when color is 7", kColorDarkWhite, make_tuple(7U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorBrightBlack when color is 8",
kColorBrightBlack,
make_tuple(8U)),
"should set background color to kColorBrightBlack when color is 8", kColorBrightBlack, make_tuple(8U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorBrightBlue when color is 9",
kColorBrightBlue,
make_tuple(9U)),
"should set background color to kColorBrightBlue when color is 9", kColorBrightBlue, make_tuple(9U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorBrightGreen when color is 10",
kColorBrightGreen,
make_tuple(10U)),
"should set background color to kColorBrightGreen when color is 10", kColorBrightGreen, make_tuple(10U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorBrightCyan when color is 11",
kColorBrightCyan,
make_tuple(11U)),
"should set background color to kColorBrightCyan when color is 11", kColorBrightCyan, make_tuple(11U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorBrightRed when color is 12",
kColorBrightRed,
make_tuple(12U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorBrightMagenta when color is 13",
"should set background color to kColorBrightRed when color is 12", kColorBrightRed, make_tuple(12U)),
make_test<uint32_t, uint32_t>("should set background color to kColorBrightMagenta when color is 13",
kColorBrightMagenta,
make_tuple(13U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorBrightOrange when color is 14",
make_test<uint32_t, uint32_t>("should set background color to kColorBrightOrange when color is 14",
kColorBrightOrange,
make_tuple(14U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorBrightYellow when color is 14",
make_test<uint32_t, uint32_t>("should set background color to kColorBrightYellow when color is 14",
kColorBrightYellow,
make_tuple(14U)),
make_test<uint32_t, uint32_t>(
"should set background color to kColorBrightWhite when color is 15",
kColorBrightWhite,
make_tuple(15U)),
})
));
"should set background color to kColorBrightWhite when color is 15", kColorBrightWhite, make_tuple(15U)),
})));
}
TestResults test_SetForegroundColor() {
@@ -323,78 +217,44 @@ TestResults test_SetForegroundColor() {
fnToTest,
vector<TestTuple<uint32_t, uint32_t>>({
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorDarkBlack when color is 0",
kColorDarkBlack,
make_tuple(0U)),
"should set foreground color to kColorDarkBlack when color is 0", kColorDarkBlack, make_tuple(0U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorDarkBlue when color is 1",
kColorDarkBlue,
make_tuple(1U)),
"should set foreground color to kColorDarkBlue when color is 1", kColorDarkBlue, make_tuple(1U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorDarkGreen when color is 2",
kColorDarkGreen,
make_tuple(2U)),
"should set foreground color to kColorDarkGreen when color is 2", kColorDarkGreen, make_tuple(2U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorDarkCyan when color is 3",
kColorDarkCyan,
make_tuple(3U)),
"should set foreground color to kColorDarkCyan when color is 3", kColorDarkCyan, make_tuple(3U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorDarkRed when color is 4",
kColorDarkRed,
make_tuple(4U)),
"should set foreground color to kColorDarkRed when color is 4", kColorDarkRed, make_tuple(4U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorDarkMagenta when color is 5",
kColorDarkMagenta,
make_tuple(5U)),
"should set foreground color to kColorDarkMagenta when color is 5", kColorDarkMagenta, make_tuple(5U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorDarkOrange when color is 6",
kColorDarkOrange,
make_tuple(6U)),
"should set foreground color to kColorDarkOrange when color is 6", kColorDarkOrange, make_tuple(6U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorDarkYellow when color is 6",
kColorDarkYellow,
make_tuple(6U)),
"should set foreground color to kColorDarkYellow when color is 6", kColorDarkYellow, make_tuple(6U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorDarkWhite when color is 7",
kColorDarkWhite,
make_tuple(7U)),
"should set foreground color to kColorDarkWhite when color is 7", kColorDarkWhite, make_tuple(7U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorBrightBlack when color is 8",
kColorBrightBlack,
make_tuple(8U)),
"should set foreground color to kColorBrightBlack when color is 8", kColorBrightBlack, make_tuple(8U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorBrightBlue when color is 9",
kColorBrightBlue,
make_tuple(9U)),
"should set foreground color to kColorBrightBlue when color is 9", kColorBrightBlue, make_tuple(9U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorBrightGreen when color is 10",
kColorBrightGreen,
make_tuple(10U)),
"should set foreground color to kColorBrightGreen when color is 10", kColorBrightGreen, make_tuple(10U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorBrightCyan when color is 11",
kColorBrightCyan,
make_tuple(11U)),
"should set foreground color to kColorBrightCyan when color is 11", kColorBrightCyan, make_tuple(11U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorBrightRed when color is 12",
kColorBrightRed,
make_tuple(12U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorBrightMagenta when color is 13",
"should set foreground color to kColorBrightRed when color is 12", kColorBrightRed, make_tuple(12U)),
make_test<uint32_t, uint32_t>("should set foreground color to kColorBrightMagenta when color is 13",
kColorBrightMagenta,
make_tuple(13U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorBrightOrange when color is 14",
make_test<uint32_t, uint32_t>("should set foreground color to kColorBrightOrange when color is 14",
kColorBrightOrange,
make_tuple(14U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorBrightYellow when color is 14",
make_test<uint32_t, uint32_t>("should set foreground color to kColorBrightYellow when color is 14",
kColorBrightYellow,
make_tuple(14U)),
make_test<uint32_t, uint32_t>(
"should set foreground color to kColorBrightWhite when color is 15",
kColorBrightWhite,
make_tuple(15U)),
})
));
"should set foreground color to kColorBrightWhite when color is 15", kColorBrightWhite, make_tuple(15U)),
})));
}
} // End namespace Test::Colors

View File

@@ -1,4 +1,5 @@
#include "Derangements.h"
#include <ostream>
#include <sstream>
@@ -6,10 +7,8 @@ namespace SBF {
using std::ostream;
bool operator==(const DerangementType& left, const DerangementType& right) {
return left.description == right.description &&
left.id == right.id &&
left.label == right.label &&
left.textColor == right.textColor;
return left.description == right.description && left.id == right.id && left.label == right.label
&& left.textColor == right.textColor;
}
bool operator!=(const DerangementType& left, const DerangementType& right) {
@@ -17,11 +16,10 @@ bool operator!=(const DerangementType& left, const DerangementType& right) {
}
ostream& operator<<(ostream& os, const DerangementType& derangement) {
//Derangement: {id: 1, label: \"kDerangementAmnesiaLabel\", description: \"kDerangementAmnesiaDescription\", textColor: kDerangementAmnesiaTextColor}
os << "Derangement: {id: " << derangement.id
<< ", label: \"" << derangement.label
<< "\", description: \"" << derangement.description
<< "\", textColor: " << (int)derangement.textColor << "}";
// Derangement: {id: 1, label: \"kDerangementAmnesiaLabel\", description: \"kDerangementAmnesiaDescription\",
// textColor: kDerangementAmnesiaTextColor}
os << "Derangement: {id: " << derangement.id << ", label: \"" << derangement.label << "\", description: \""
<< derangement.description << "\", textColor: " << (int)derangement.textColor << "}";
return os;
}

View File

@@ -26,7 +26,8 @@ namespace SBF {
const int kDerangementAmnesiaId = 1;
const uint8_t kDerangementAmnesiaTextColor = kColorDarkRed;
const std::string kDerangementAmnesiaLabel = "Amnesia";
const std::string kDerangementAmnesiaDescription = R"---(You forget a segment of your past. Additionally in some cases a character can forget abilities and be unable to use them for the duration.)---";
const std::string kDerangementAmnesiaDescription =
R"---(You forget a segment of your past. Additionally in some cases a character can forget abilities and be unable to use them for the duration.)---";
const int kDerangementDelusionsOfGrandeurId = 2;
const uint8_t kDerangementDelusionsOfGrandeurTextColor = kColorDarkMagenta;
const std::string kDerangementDelusionsOfGrandeurLabel = "Delusions of Grandeur";
@@ -34,15 +35,18 @@ namespace SBF {
const int kDerangementFantasyId = 3;
const uint8_t kDerangementFantasyTextColor = kColorDarkOrange;
const std::string kDerangementFantasyLabel = "Fantasy";
const std::string kDerangementFantasyDescription = R"---(You enter a self-created world where you are the forgotten hero.)---";
const std::string kDerangementFantasyDescription =
R"---(You enter a self-created world where you are the forgotten hero.)---";
const int kDerangementManicDepressionId = 4;
const uint8_t kDerangementManicDepressionTextColor = kColorDarkWhite;
const std::string kDerangementManicDepressionLabel = "Manic-Depression";
const std::string kDerangementManicDepressionDescription = R"---(You sink into deep and fitful depressions, showing no interest in anything which used to captivate your interests. You will go along with others rather than use the energy to resist. Occasional fits of great energy grab hold of you, and you will work for hours or even days on your projects. During this time you will resist even the need for sleep as you burn up blood and Willpower on your schemes.)---";
const std::string kDerangementManicDepressionDescription =
R"---(You sink into deep and fitful depressions, showing no interest in anything which used to captivate your interests. You will go along with others rather than use the energy to resist. Occasional fits of great energy grab hold of you, and you will work for hours or even days on your projects. During this time you will resist even the need for sleep as you burn up blood and Willpower on your schemes.)---";
const int kDerangementMultiplePersonalitiesId = 5;
const uint8_t kDerangementMultiplePersonalitiesTextColor = kColorDarkBlue;
const std::string kDerangementMultiplePersonalitiesLabel = "Multiple Personalities";
const std::string kDerangementMultiplePersonalitiesDescription = R"---(You possess a number of new personalities. You have amore than one Mature, and will switch between them. Thus you regain Willpower points in defferent ways at defferent times)---";
const std::string kDerangementMultiplePersonalitiesDescription =
R"---(You possess a number of new personalities. You have amore than one Mature, and will switch between them. Thus you regain Willpower points in defferent ways at defferent times)---";
const int kDerangementObsessionId = 6;
const uint8_t kDerangementObsessionTextColor = kColorBrightGreen;
const std::string kDerangementObsessionLabel = "Obsession";
@@ -50,19 +54,23 @@ namespace SBF {
const int kDerangementOvercompensationId = 7;
const uint8_t kDerangementOvercompensationTextColor = kColorBrightCyan;
const std::string kDerangementOvercompensationLabel = "Overcompensation";
const std::string kDerangementOvercompensationDescription = R"---(You make up for your moral weaknesses by playing up your strengths to an extreme. You don't think you can frenzy and won't stop it.)---";
const std::string kDerangementOvercompensationDescription =
R"---(You make up for your moral weaknesses by playing up your strengths to an extreme. You don't think you can frenzy and won't stop it.)---";
const int kDerangementParanoiaId = 8;
const uint8_t kDerangementParanoiaTextColor = kColorBrightRed;
const std::string kDerangementParanoiaLabel = "Paranoia";
const std::string kDerangementParanoiaDescription = R"---(You are convinced that you are being hunted. You hold even your closest Friends under suspicion.)---";
const std::string kDerangementParanoiaDescription =
R"---(You are convinced that you are being hunted. You hold even your closest Friends under suspicion.)---";
const int kDerangementPerfectionId = 9;
const uint8_t kDerangementPerfectionTextColor = kColorBrightMagenta;
const std::string kDerangementPerfectionLabel = "Perfection";
const std::string kDerangementPerfectionDescription = R"---(All your energy is directed toward preventing anything from going wong. When it does you must make a self-control roll or frenzy.)---";
const std::string kDerangementPerfectionDescription =
R"---(All your energy is directed toward preventing anything from going wong. When it does you must make a self-control roll or frenzy.)---";
const int kDerangementRegressionId = 10;
const uint8_t kDerangementRegressionTextColor = kColorBrightYellow;
const std::string kDerangementRegressionLabel = "Regression";
const std::string kDerangementRegressionDescription = R"---(You become childlike retreating to an earlier time when less was expected of you Willpower is regained inthe way a Child's is.)---";
const std::string kDerangementRegressionDescription =
R"---(You become childlike retreating to an earlier time when less was expected of you Willpower is regained inthe way a Child's is.)---";
const DerangementType kDerangementUnknown = {0, "", "", 0};
const DerangementType kDerangementAmnesia = {
kDerangementAmnesiaId,
@@ -209,5 +217,6 @@ namespace SBF {
/// @param derangements The vector to fill. It will be emptied first.
void FillDerangements(std::vector<DerangementType>& derangements);
} // End namespace SBF
/** @}*/
#endif // End !defined DERANGEMENTS_H__

View File

@@ -1,9 +1,11 @@
#include "Derangements.h"
#include "test.h"
#include <string>
#include <vector>
#include <tuple>
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
#include "test.h"
using namespace SBF;
using namespace Test;
@@ -15,7 +17,8 @@ TestResults test_DerangementType_operator_equal_to();
TestResults test_DerangementType_operator_not_equal_to();
TestResults test_GetDerangement();
TestResults test_FillDerangements();
} // End Test::Derangements
} // namespace Test::Derangements
using namespace Test::Derangements;
TestResults main_test_Derangements(int argc, char** argv) {
@@ -29,62 +32,76 @@ TestResults main_test_Derangements(int argc, char** argv) {
return results;
}
namespace Test::Derangements {
TestResults test_GetDerangement() {
return execute_suite<DerangementType, int>(make_test_suite(
"SBF::GetDerangement",
GetDerangement,
vector<TestTuple<DerangementType, int>>({
make_test<DerangementType, int>(
"should get {0, "", "", 0} for invalid derangement id 0",
make_test<DerangementType, int>("should get {0, "
", "
", 0} for invalid derangement id 0",
{0, "", "", 0},
make_tuple(0)),
make_test<DerangementType, int>(
"should get {kDerangementAmnesiaId, kDerangementAmnesiaLabel, kDerangementAmnesiaDescription, kDerangementAmnesiaTextColor} for derangement id 1",
"should get {kDerangementAmnesiaId, kDerangementAmnesiaLabel, kDerangementAmnesiaDescription, "
"kDerangementAmnesiaTextColor} for derangement id 1",
kDerangementAmnesia,
make_tuple(1)),
make_test<DerangementType, int>(
"should get {kDerangementDelusionsOfGrandeurId, kDerangementDelusionsOfGrandeurLabel, kDerangementDelusionsOfGrandeurDescription, kDerangementDelusionsOfGrandeurTextColor} for derangement id 2",
"should get {kDerangementDelusionsOfGrandeurId, kDerangementDelusionsOfGrandeurLabel, "
"kDerangementDelusionsOfGrandeurDescription, kDerangementDelusionsOfGrandeurTextColor} for derangement "
"id 2",
kDerangementDelusionsOfGrandeur,
make_tuple(2)),
make_test<DerangementType, int>(
"should get {kDerangementFantasyId, kDerangementFantasyLabel, kDerangementFantasyDescription, kDerangementFantasyTextColor} for derangement id 3",
"should get {kDerangementFantasyId, kDerangementFantasyLabel, kDerangementFantasyDescription, "
"kDerangementFantasyTextColor} for derangement id 3",
kDerangementFantasy,
make_tuple(3)),
make_test<DerangementType, int>(
"should get {kDerangementManicDepressionId, kDerangementManicDepressionLabel, kDerangementManicDepressionDescription, kDerangementManicDepressionTextColor} for derangement id 4",
"should get {kDerangementManicDepressionId, kDerangementManicDepressionLabel, "
"kDerangementManicDepressionDescription, kDerangementManicDepressionTextColor} for derangement id 4",
kDerangementManicDepression,
make_tuple(4)),
make_test<DerangementType, int>(
"should get {kDerangementMultiplePersonalitiesId, kDerangementMultiplePersonalitiesLabel, kDerangementMultiplePersonalitiesDescription, kDerangementMultiplePersonalitiesTextColor} for derangement id 5",
"should get {kDerangementMultiplePersonalitiesId, kDerangementMultiplePersonalitiesLabel, "
"kDerangementMultiplePersonalitiesDescription, kDerangementMultiplePersonalitiesTextColor} for "
"derangement id 5",
kDerangementMultiplePersonalities,
make_tuple(5)),
make_test<DerangementType, int>(
"should get {kDerangementObsessionId, kDerangementObsessionLabel, kDerangementObsessionDescription, kDerangementObsessionTextColor} for derangement id 6",
"should get {kDerangementObsessionId, kDerangementObsessionLabel, kDerangementObsessionDescription, "
"kDerangementObsessionTextColor} for derangement id 6",
kDerangementObsession,
make_tuple(6)),
make_test<DerangementType, int>(
"should get {kDerangementOvercompensationId, kDerangementOvercompensationLabel, kDerangementOvercompensationDescription, kDerangementOvercompensationTextColor} for derangement id 7",
"should get {kDerangementOvercompensationId, kDerangementOvercompensationLabel, "
"kDerangementOvercompensationDescription, kDerangementOvercompensationTextColor} for derangement id 7",
kDerangementOvercompensation,
make_tuple(7)),
make_test<DerangementType, int>(
"should get {kDerangementParanoiaId, kDerangementParanoiaLabel, kDerangementParanoiaDescription, kDerangementParanoiaTextColor} for derangement id 8",
"should get {kDerangementParanoiaId, kDerangementParanoiaLabel, kDerangementParanoiaDescription, "
"kDerangementParanoiaTextColor} for derangement id 8",
kDerangementParanoia,
make_tuple(8)),
make_test<DerangementType, int>(
"should get {kDerangementPerfectionId, kDerangementPerfectionLabel, kDerangementPerfectionDescription, kDerangementPerfectionTextColor} for derangement id 9",
"should get {kDerangementPerfectionId, kDerangementPerfectionLabel, kDerangementPerfectionDescription, "
"kDerangementPerfectionTextColor} for derangement id 9",
kDerangementPerfection,
make_tuple(9)),
make_test<DerangementType, int>(
"should get {kDerangementRegressionId, kDerangementRegressionLabel, kDerangementRegressionDescription, kDerangementRegressionTextColor} for derangement id 10",
"should get {kDerangementRegressionId, kDerangementRegressionLabel, kDerangementRegressionDescription, "
"kDerangementRegressionTextColor} for derangement id 10",
kDerangementRegression,
make_tuple(10)),
make_test<DerangementType, int>(
"should get {0, "", "", 0} for invalid derangement id 11",
make_test<DerangementType, int>("should get {0, "
", "
", 0} for invalid derangement id 11",
{0, "", "", 0},
make_tuple(11)),
})
));
})));
}
TestResults test_FillDerangements() {
@@ -102,9 +119,7 @@ TestResults test_FillDerangements() {
kDerangementPerfection,
kDerangementRegression,
};
vector<DerangementType> actual = {
{-1, "This should be removed.", "This should be removed.", 255}
};
vector<DerangementType> actual = {{-1, "This should be removed.", "This should be removed.", 255}};
FillDerangements(actual);
compare(error_message, expected, actual);
string error = error_message.str();
@@ -113,16 +128,12 @@ TestResults test_FillDerangements() {
}
return "no errors";
};
return execute_suite<string>(make_test_suite(
"SBF::FillDerangements",
return execute_suite<string>(
make_test_suite("SBF::FillDerangements",
fnToTest,
vector<TestTuple<string>>({
make_test<string>(
"should fill derangements",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill derangements", "no errors", make_tuple()),
})));
}
TestResults test_DerangementType_operator_extract() {
@@ -134,62 +145,67 @@ TestResults test_DerangementType_operator_extract() {
return os.str();
},
vector<TestTuple<string, DerangementType>>({
make_test<string, DerangementType>(
"should print amnesia",
"Derangement: {id: 1, label: \"" + kDerangementAmnesiaLabel + "\", description: \"" + kDerangementAmnesiaDescription + "\", textColor: 4}",
make_test<string, DerangementType>("should print amnesia",
"Derangement: {id: 1, label: \"" + kDerangementAmnesiaLabel
+ "\", description: \"" + kDerangementAmnesiaDescription
+ "\", textColor: 4}",
make_tuple(kDerangementAmnesia)),
make_test<string, DerangementType>(
"should print delusions of grandeur",
"Derangement: {id: 2, label: \"" + kDerangementDelusionsOfGrandeurLabel + "\", description: \"" + kDerangementDelusionsOfGrandeurDescription + "\", textColor: 5}",
make_test<string, DerangementType>("should print delusions of grandeur",
"Derangement: {id: 2, label: \"" + kDerangementDelusionsOfGrandeurLabel
+ "\", description: \"" + kDerangementDelusionsOfGrandeurDescription
+ "\", textColor: 5}",
make_tuple(kDerangementDelusionsOfGrandeur)),
make_test<string, DerangementType>(
"should print fantasy",
"Derangement: {id: 3, label: \"" + kDerangementFantasyLabel + "\", description: \"" + kDerangementFantasyDescription + "\", textColor: 6}",
make_test<string, DerangementType>("should print fantasy",
"Derangement: {id: 3, label: \"" + kDerangementFantasyLabel
+ "\", description: \"" + kDerangementFantasyDescription
+ "\", textColor: 6}",
make_tuple(kDerangementFantasy)),
make_test<string, DerangementType>(
"should print manic depression",
"Derangement: {id: 4, label: \"" + kDerangementManicDepressionLabel + "\", description: \"" + kDerangementManicDepressionDescription + "\", textColor: 7}",
make_test<string, DerangementType>("should print manic depression",
"Derangement: {id: 4, label: \"" + kDerangementManicDepressionLabel
+ "\", description: \"" + kDerangementManicDepressionDescription
+ "\", textColor: 7}",
make_tuple(kDerangementManicDepression)),
make_test<string, DerangementType>(
"should print multiple personalities",
"Derangement: {id: 5, label: \"" + kDerangementMultiplePersonalitiesLabel + "\", description: \"" + kDerangementMultiplePersonalitiesDescription + "\", textColor: 1}",
make_test<string, DerangementType>("should print multiple personalities",
"Derangement: {id: 5, label: \"" + kDerangementMultiplePersonalitiesLabel
+ "\", description: \"" + kDerangementMultiplePersonalitiesDescription
+ "\", textColor: 1}",
make_tuple(kDerangementMultiplePersonalities)),
make_test<string, DerangementType>(
"should print obsession",
"Derangement: {id: 6, label: \"" + kDerangementObsessionLabel + "\", description: \"" + kDerangementObsessionDescription + "\", textColor: 10}",
make_test<string, DerangementType>("should print obsession",
"Derangement: {id: 6, label: \"" + kDerangementObsessionLabel
+ "\", description: \"" + kDerangementObsessionDescription
+ "\", textColor: 10}",
make_tuple(kDerangementObsession)),
make_test<string, DerangementType>(
"should print overcompensation",
"Derangement: {id: 7, label: \"" + kDerangementOvercompensationLabel + "\", description: \"" + kDerangementOvercompensationDescription + "\", textColor: 11}",
make_test<string, DerangementType>("should print overcompensation",
"Derangement: {id: 7, label: \"" + kDerangementOvercompensationLabel
+ "\", description: \"" + kDerangementOvercompensationDescription
+ "\", textColor: 11}",
make_tuple(kDerangementOvercompensation)),
make_test<string, DerangementType>(
"should print paranoia",
"Derangement: {id: 8, label: \"" + kDerangementParanoiaLabel + "\", description: \"" + kDerangementParanoiaDescription + "\", textColor: 12}",
make_test<string, DerangementType>("should print paranoia",
"Derangement: {id: 8, label: \"" + kDerangementParanoiaLabel
+ "\", description: \"" + kDerangementParanoiaDescription
+ "\", textColor: 12}",
make_tuple(kDerangementParanoia)),
make_test<string, DerangementType>(
"should print perfection",
"Derangement: {id: 9, label: \"" + kDerangementPerfectionLabel + "\", description: \"" + kDerangementPerfectionDescription + "\", textColor: 13}",
make_test<string, DerangementType>("should print perfection",
"Derangement: {id: 9, label: \"" + kDerangementPerfectionLabel
+ "\", description: \"" + kDerangementPerfectionDescription
+ "\", textColor: 13}",
make_tuple(kDerangementPerfection)),
make_test<string, DerangementType>(
"should print regression",
"Derangement: {id: 10, label: \"" + kDerangementRegressionLabel + "\", description: \"" + kDerangementRegressionDescription + "\", textColor: 14}",
make_test<string, DerangementType>("should print regression",
"Derangement: {id: 10, label: \"" + kDerangementRegressionLabel
+ "\", description: \"" + kDerangementRegressionDescription
+ "\", textColor: 14}",
make_tuple(kDerangementRegression)),
make_test<string, DerangementType>(
"should print an unknown derangement",
"Derangement: {id: 0, label: \"MyLabel\", description: \"My Description\", textColor: 5}",
make_tuple((DerangementType){
0, "MyLabel", "My Description", 5})),
})
));
make_tuple((DerangementType){0, "MyLabel", "My Description", 5})),
})));
}
TestResults test_DerangementType_operator_equal_to() {
return execute_suite<bool, DerangementType, DerangementType>(
make_test_suite(
return execute_suite<bool, DerangementType, DerangementType>(make_test_suite(
"SBF::DerangementType::operator==",
[](const DerangementType& left, const DerangementType& right) {
return left == right;
},
[](const DerangementType& left, const DerangementType& right) { return left == right; },
vector<TestTuple<bool, DerangementType, DerangementType>>({
make_test<bool, DerangementType, DerangementType>(
"should return true when comparing a derangement to itself",
@@ -198,22 +214,22 @@ TestResults test_DerangementType_operator_equal_to() {
make_test<bool, DerangementType, DerangementType>(
"should return true when comparing two different instances created with the same values",
true,
make_tuple(kDerangementFantasy, DerangementType({kDerangementFantasyId, kDerangementFantasyLabel, kDerangementFantasyDescription, kDerangementFantasyTextColor}))),
make_tuple(kDerangementFantasy,
DerangementType({kDerangementFantasyId,
kDerangementFantasyLabel,
kDerangementFantasyDescription,
kDerangementFantasyTextColor}))),
make_test<bool, DerangementType, DerangementType>(
"should return false when comparing two different derangements",
false,
make_tuple(kDerangementManicDepression, kDerangementParanoia)),
})
));
})));
}
TestResults test_DerangementType_operator_not_equal_to() {
return execute_suite<bool, DerangementType, DerangementType>(
make_test_suite(
return execute_suite<bool, DerangementType, DerangementType>(make_test_suite(
"SBF::DerangementType::operator!=",
[](const DerangementType& left, const DerangementType& right) {
return left != right;
},
[](const DerangementType& left, const DerangementType& right) { return left != right; },
vector<TestTuple<bool, DerangementType, DerangementType>>({
make_test<bool, DerangementType, DerangementType>(
"should return false when comparing a derangement to itself",
@@ -222,13 +238,16 @@ TestResults test_DerangementType_operator_not_equal_to() {
make_test<bool, DerangementType, DerangementType>(
"should return false when comparing two different instances created with the same values",
false,
make_tuple(kDerangementFantasy, DerangementType({kDerangementFantasyId, kDerangementFantasyLabel, kDerangementFantasyDescription, kDerangementFantasyTextColor}))),
make_tuple(kDerangementFantasy,
DerangementType({kDerangementFantasyId,
kDerangementFantasyLabel,
kDerangementFantasyDescription,
kDerangementFantasyTextColor}))),
make_test<bool, DerangementType, DerangementType>(
"should return true when comparing two different derangements",
true,
make_tuple(kDerangementManicDepression, kDerangementParanoia)),
})
));
})));
}
} // End Test::Derangements
} // namespace Test::Derangements

View File

@@ -1,4 +1,5 @@
#include "Disciplines.h"
#include <string>
#include <vector>

View File

@@ -103,5 +103,6 @@ namespace SBF {
/// @param discipline_labels The vector to fill. It will be cleared first.
void FillDisciplineLabels(std::vector<std::string>& discipline_labels);
} // End namespace SBF
/** @}*/
#endif // End !defined DISCIPLINES_H__

View File

@@ -1,9 +1,11 @@
#include "Disciplines.h"
#include "test.h"
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
#include <sstream>
#include "test.h"
using namespace SBF;
using namespace Test;
@@ -13,6 +15,7 @@ namespace Test::Disciplines {
TestResults test_GetDisciplineLabel();
TestResults test_FillDisciplineLabels();
} // End namespace Test::Disciplines
using namespace Test::Disciplines;
TestResults main_test_Disciplines(int argc, char** argv) {
@@ -30,142 +33,47 @@ TestResults test_GetDisciplineLabel() {
"SBF::GetDisciplineLabel",
GetDisciplineLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get \"\" for invalid discipline id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"Animalism\" for id 1",
"Animalism",
make_tuple(1)),
make_test<string, int>(
"should get \"Auspex\" for id 2",
"Auspex",
make_tuple(2)),
make_test<string, int>(
"should get \"Bardo\" for id 3",
"Bardo",
make_tuple(3)),
make_test<string, int>(
"should get \"Celerity\" for id 4",
"Celerity",
make_tuple(4)),
make_test<string, int>(
"should get \"Chimestry\" for id 5",
"Chimestry",
make_tuple(5)),
make_test<string, int>(
"should get \"Dementation\" for id 6",
"Dementation",
make_tuple(6)),
make_test<string, int>(
"should get \"Dominate\" for id 7",
"Dominate",
make_tuple(7)),
make_test<string, int>(
"should get \"Fortitude\" for id 8",
"Fortitude",
make_tuple(8)),
make_test<string, int>(
"should get \"Melpominee\" for id 9",
"Melpominee",
make_tuple(9)),
make_test<string, int>(
"should get \"Mortis\" for id 10",
"Mortis",
make_tuple(10)),
make_test<string, int>(
"should get \"Mytherceria\" for id 11",
"Mytherceria",
make_tuple(11)),
make_test<string, int>(
"should get \"Necromancy\" for id 12",
"Necromancy",
make_tuple(12)),
make_test<string, int>(
"should get \"Obeah\" for id 13",
"Obeah",
make_tuple(13)),
make_test<string, int>(
"should get \"Obfuscate\" for id 14",
"Obfuscate",
make_tuple(14)),
make_test<string, int>(
"should get \"Obtenebration\" for id 15",
"Obtenebration",
make_tuple(15)),
make_test<string, int>(
"should get \"Potence\" for id 16",
"Potence",
make_tuple(16)),
make_test<string, int>(
"should get \"Presence\" for id 17",
"Presence",
make_tuple(17)),
make_test<string, int>(
"should get \"Protean\" for id 18",
"Protean",
make_tuple(18)),
make_test<string, int>(
"should get \"Quietus\" for id 19",
"Quietus",
make_tuple(19)),
make_test<string, int>(
"should get \"Serpentis\" for id 20",
"Serpentis",
make_tuple(20)),
make_test<string, int>(
"should get \"Spiritus\" for id 21",
"Spiritus",
make_tuple(21)),
make_test<string, int>(
"should get \"Thanantosis\" for id 22",
"Thanantosis",
make_tuple(22)),
make_test<string, int>(
"should get \"Thaumaturgy\" for id 23",
"Thaumaturgy",
make_tuple(23)),
make_test<string, int>(
"should get \"Vicissitude\" for id 24",
"Vicissitude",
make_tuple(24)),
make_test<string, int>(
"should get \"\" for invalid discipline id 25",
"",
make_tuple(25)),
})
));
make_test<string, int>("should get \"\" for invalid discipline id 0", "", make_tuple(0)),
make_test<string, int>("should get \"Animalism\" for id 1", "Animalism", make_tuple(1)),
make_test<string, int>("should get \"Auspex\" for id 2", "Auspex", make_tuple(2)),
make_test<string, int>("should get \"Bardo\" for id 3", "Bardo", make_tuple(3)),
make_test<string, int>("should get \"Celerity\" for id 4", "Celerity", make_tuple(4)),
make_test<string, int>("should get \"Chimestry\" for id 5", "Chimestry", make_tuple(5)),
make_test<string, int>("should get \"Dementation\" for id 6", "Dementation", make_tuple(6)),
make_test<string, int>("should get \"Dominate\" for id 7", "Dominate", make_tuple(7)),
make_test<string, int>("should get \"Fortitude\" for id 8", "Fortitude", make_tuple(8)),
make_test<string, int>("should get \"Melpominee\" for id 9", "Melpominee", make_tuple(9)),
make_test<string, int>("should get \"Mortis\" for id 10", "Mortis", make_tuple(10)),
make_test<string, int>("should get \"Mytherceria\" for id 11", "Mytherceria", make_tuple(11)),
make_test<string, int>("should get \"Necromancy\" for id 12", "Necromancy", make_tuple(12)),
make_test<string, int>("should get \"Obeah\" for id 13", "Obeah", make_tuple(13)),
make_test<string, int>("should get \"Obfuscate\" for id 14", "Obfuscate", make_tuple(14)),
make_test<string, int>("should get \"Obtenebration\" for id 15", "Obtenebration", make_tuple(15)),
make_test<string, int>("should get \"Potence\" for id 16", "Potence", make_tuple(16)),
make_test<string, int>("should get \"Presence\" for id 17", "Presence", make_tuple(17)),
make_test<string, int>("should get \"Protean\" for id 18", "Protean", make_tuple(18)),
make_test<string, int>("should get \"Quietus\" for id 19", "Quietus", make_tuple(19)),
make_test<string, int>("should get \"Serpentis\" for id 20", "Serpentis", make_tuple(20)),
make_test<string, int>("should get \"Spiritus\" for id 21", "Spiritus", make_tuple(21)),
make_test<string, int>("should get \"Thanantosis\" for id 22", "Thanantosis", make_tuple(22)),
make_test<string, int>("should get \"Thaumaturgy\" for id 23", "Thaumaturgy", make_tuple(23)),
make_test<string, int>("should get \"Vicissitude\" for id 24", "Vicissitude", make_tuple(24)),
make_test<string, int>("should get \"\" for invalid discipline id 25", "", make_tuple(25)),
})));
}
TestResults test_FillDisciplineLabels() {
auto fnToTest = []() -> string {
ostringstream error_message;
vector<string> expected = {
kDisciplineAnimalismLabel,
kDisciplineAuspexLabel,
kDisciplineBardoLabel,
kDisciplineCelerityLabel,
kDisciplineChimestryLabel,
kDisciplineDementationLabel,
kDisciplineDominateLabel,
kDisciplineFortitudeLabel,
kDisciplineMelpomineeLabel,
kDisciplineMortisLabel,
kDisciplineMytherceriaLabel,
kDisciplineNecromancyLabel,
kDisciplineObeahLabel,
kDisciplineObfuscateLabel,
kDisciplineObtenebrationLabel,
kDisciplinePotenceLabel,
kDisciplinePresenceLabel,
kDisciplineProteanLabel,
kDisciplineQuietusLabel,
kDisciplineSerpentisLabel,
kDisciplineSpiritusLabel,
kDisciplineThanantosisLabel,
kDisciplineThaumaturgyLabel,
kDisciplineVicissitudeLabel,
kDisciplineAnimalismLabel, kDisciplineAuspexLabel, kDisciplineBardoLabel,
kDisciplineCelerityLabel, kDisciplineChimestryLabel, kDisciplineDementationLabel,
kDisciplineDominateLabel, kDisciplineFortitudeLabel, kDisciplineMelpomineeLabel,
kDisciplineMortisLabel, kDisciplineMytherceriaLabel, kDisciplineNecromancyLabel,
kDisciplineObeahLabel, kDisciplineObfuscateLabel, kDisciplineObtenebrationLabel,
kDisciplinePotenceLabel, kDisciplinePresenceLabel, kDisciplineProteanLabel,
kDisciplineQuietusLabel, kDisciplineSerpentisLabel, kDisciplineSpiritusLabel,
kDisciplineThanantosisLabel, kDisciplineThaumaturgyLabel, kDisciplineVicissitudeLabel,
};
vector<string> actual = {"This should be removed."};
FillDisciplineLabels(actual);
@@ -176,15 +84,11 @@ TestResults test_FillDisciplineLabels() {
}
return "no errors";
};
return execute_suite<string>(make_test_suite(
"SBF::FillDisciplineLabels",
return execute_suite<string>(
make_test_suite("SBF::FillDisciplineLabels",
fnToTest,
vector<TestTuple<string>>({
make_test<string>(
"should fill disciplines",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill disciplines", "no errors", make_tuple()),
})));
}
} // End namespace Test::Disciplines

View File

@@ -1,4 +1,5 @@
#include "Genders.h"
#include <string>
#include <vector>

View File

@@ -44,5 +44,6 @@ namespace SBF {
/// @param gender_labels The vector to fill. It will be cleared first.
void FillGenderLabels(std::vector<std::string>& gender_labels);
} // End namespace SBF
/** @}*/
#endif // End !defined GENDERS_H__

View File

@@ -1,9 +1,11 @@
#include "Genders.h"
#include "test.h"
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
#include <sstream>
#include "test.h"
using namespace SBF;
using namespace Test;
@@ -13,6 +15,7 @@ namespace Test::Genders {
TestResults test_GetGenderLabel();
TestResults test_FillGenderLabels();
} // End namespace Test::Genders
using namespace Test::Genders;
TestResults main_test_Genders(int argc, char** argv) {
@@ -30,36 +33,14 @@ TestResults test_GetGenderLabel() {
"SBF::GetGenderLabel",
GetGenderLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get \"\" for invalid gender id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"Male\" for gender id 1",
"Male",
make_tuple(1)),
make_test<string, int>(
"should get \"Female\" for gender id 2",
"Female",
make_tuple(2)),
make_test<string, int>(
"should get \"Trans-Male\" for gender id 3",
"Trans-Male",
make_tuple(3)),
make_test<string, int>(
"should get \"Trans-Female\" for gender id 4",
"Trans-Female",
make_tuple(4)),
make_test<string, int>(
"should get \"Non-Binary\" for gender id 5",
"Non-Binary",
make_tuple(5)),
make_test<string, int>(
"should get \"\" for invalid gender id 6",
"",
make_tuple(6)),
})
));
make_test<string, int>("should get \"\" for invalid gender id 0", "", make_tuple(0)),
make_test<string, int>("should get \"Male\" for gender id 1", "Male", make_tuple(1)),
make_test<string, int>("should get \"Female\" for gender id 2", "Female", make_tuple(2)),
make_test<string, int>("should get \"Trans-Male\" for gender id 3", "Trans-Male", make_tuple(3)),
make_test<string, int>("should get \"Trans-Female\" for gender id 4", "Trans-Female", make_tuple(4)),
make_test<string, int>("should get \"Non-Binary\" for gender id 5", "Non-Binary", make_tuple(5)),
make_test<string, int>("should get \"\" for invalid gender id 6", "", make_tuple(6)),
})));
}
TestResults test_FillGenderLabels() {
@@ -81,15 +62,10 @@ TestResults test_FillGenderLabels() {
}
return "no errors";
};
return execute_suite<string>(make_test_suite(
"SBF::FillGenderLabels",
return execute_suite<string>(make_test_suite("SBF::FillGenderLabels",
fnToTest,
vector<TestTuple<string>>({
make_test<string>(
"should fill genders",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill genders", "no errors", make_tuple()),
})));
}
} // End namespace Test::Genders

View File

@@ -114,31 +114,22 @@ Sub PrintMenu (items() As MenuItem, count As Integer, style As MenuStyle)
If column <> (itemsPerRow - 1) Then
If i <> count Or style.showRandom Then
textLength = Len(itemText$)
itemText$ = MakeFitL$(RTrim$(itemText$) + style.menuItemSpacer, textLength + Len(style.menuItemSpacer), " ")
End If
End If
Print MakeFitC$(itemText$, columnWidth, " ");
End If
column = (column + 1) Mod itemsPerRow
If column = 0 Then Print ""
Next
If style.showRandom Then
Print MakeFitC$(GetTitleWithoutValue$(randomItem, style), columnWidth, " ")
End If
End If
End Sub
itemText$ = MakeFitL$(RTrim$(itemText$) + style.menuItemSpacer, textLength +
Len(style.menuItemSpacer), " ") End If End If Print MakeFitC$(itemText$, columnWidth, " "); End If column = (column + 1)
Mod itemsPerRow If column = 0 Then Print "" Next If style.showRandom Then Print
MakeFitC$(GetTitleWithoutValue$(randomItem, style), columnWidth, " ") End If End If End Sub
Function GetTitle$ (mi As MenuItem, ms As MenuStyle)
id$ = itos$(mi.id)
label$ = mi.label
If ms.valueWidth > 0 Then label$ = label$ + ms.labelValueSeparator
value$ = itos$(mi.value)
GetTitle$ = MakeFitR$(id$, ms.idWidth, " ") + ms.idLabelSeparator + MakeFitL$(label$, ms.labelWidth, " ") + MakeFitR$(value$, ms.valueWidth, " ")
End Function
GetTitle$ = MakeFitR$(id$, ms.idWidth, " ") + ms.idLabelSeparator + MakeFitL$(label$, ms.labelWidth, " ") +
MakeFitR$(value$, ms.valueWidth, " ") End Function
Function GetTitleWithoutValue$ (mi As MenuItem, ms As MenuStyle)
GetTitleWithoutValue$ = MakeFitR$(itos(mi.id), ms.idWidth, " ") + ms.idLabelSeparator + MakeFitL$(mi.label, ms.labelWidth + ms.valueWidth + Len(ms.labelValueSeparator), " ")
End Function
GetTitleWithoutValue$ = MakeFitR$(itos(mi.id), ms.idWidth, " ") + ms.idLabelSeparator + MakeFitL$(mi.label,
ms.labelWidth + ms.valueWidth + Len(ms.labelValueSeparator), " ") End Function
Sub NewMenuStyle (ms As MenuStyle)
ms.idWidth = 0

View File

@@ -1,5 +1,6 @@
#ifndef MENUS_H__
#define MENUS_H__
/***************************************************************************************
* @file Menus.h
*
@@ -12,10 +13,11 @@
namespace SBF {
struct MenuStyle;
struct MenuItem;
}
} // namespace SBF
// End forward declarations
#include <string>
#include <cstdint>
#include <string>
/** \addtogroup Menus
* @{
@@ -59,5 +61,6 @@ namespace SBF {
void NewMenuItemWithColor(MenuItem& item, string label, int id, uint8_t color);
} // End namespace SBF
/** @}*/
#endif // !defined MENUS_H__

View File

@@ -1,15 +1,15 @@
#include "Ranks.h"
#include <ostream>
#include <string>
#include <vector>
#include <ostream>
namespace SBF {
using std::string;
using std::vector;
std::ostream& operator<<(std::ostream& os, const RankType& rank) {
os << "Rank: {id: " << rank.id
<< ", label: \"" << rank.label << "\"}";
os << "Rank: {id: " << rank.id << ", label: \"" << rank.label << "\"}";
return os;
}

View File

@@ -67,5 +67,6 @@ namespace SBF {
/// @param ranks The vector to fill. It will be cleared first.
void FillRanks(std::vector<RankType>& ranks);
} // End namespace SBF
/** @}*/
#endif // !defined RANKS_H__

View File

@@ -1,9 +1,11 @@
#include "Ranks.h"
#include "test.h"
#include <sstream>
#include <string>
#include <tuple>
#include <vector>
#include <sstream>
#include "test.h"
using namespace SBF;
using namespace Test;
@@ -16,6 +18,7 @@ TestResults test_RankType_operator_not_equal_to();
TestResults test_GetRank();
TestResults test_FillRanks();
} // End namespace Test::Ranks
using namespace Test::Ranks;
TestResults main_test_Ranks(int argc, char** argv) {
@@ -36,28 +39,15 @@ TestResults test_GetRank() {
"SBF::GetRank",
GetRank,
vector<TestTuple<RankType, int>>({
make_test<RankType, int>("should get {0, \"\"} for invalid rank id 0", RankType({0, ""}), make_tuple(0)),
make_test<RankType, int>(
"should get {0, \"\"} for invalid rank id 0",
RankType({0, ""}),
make_tuple(0)),
"should get {1, \"Primary\"} for rank id 1", RankType({1, "Primary"}), make_tuple(1)),
make_test<RankType, int>(
"should get {1, \"Primary\"} for rank id 1",
RankType({1, "Primary"}),
make_tuple(1)),
"should get {2, \"Secondary\"} for rank id 2", RankType({2, "Secondary"}), make_tuple(2)),
make_test<RankType, int>(
"should get {2, \"Secondary\"} for rank id 2",
RankType({2, "Secondary"}),
make_tuple(2)),
make_test<RankType, int>(
"should get {3, \"Tertiary\"} for rank id 3",
RankType({3, "Tertiary"}),
make_tuple(3)),
make_test<RankType, int>(
"should get {0, \"\"} for invalid rank id 6",
RankType({0, ""}),
make_tuple(6)),
})
));
"should get {3, \"Tertiary\"} for rank id 3", RankType({3, "Tertiary"}), make_tuple(3)),
make_test<RankType, int>("should get {0, \"\"} for invalid rank id 6", RankType({0, ""}), make_tuple(6)),
})));
}
TestResults test_FillRanks() {
@@ -77,16 +67,11 @@ TestResults test_FillRanks() {
}
return "no errors";
};
return execute_suite<string>(make_test_suite(
"SBF::FillRanks",
return execute_suite<string>(make_test_suite("SBF::FillRanks",
fnToTest,
vector<TestTuple<string>>({
make_test<string>(
"should fill ranks",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill ranks", "no errors", make_tuple()),
})));
}
TestResults test_RankType_operator_extract() {
@@ -100,68 +85,47 @@ TestResults test_RankType_operator_extract() {
fnToTest,
vector<TestTuple<string, RankType>>({
make_test<string, RankType>(
"should print an invalid rank",
"Rank: {id: 0, label: \"\"}",
make_tuple((RankType){0, ""})),
"should print an invalid rank", "Rank: {id: 0, label: \"\"}", make_tuple((RankType){0, ""})),
make_test<string, RankType>(
"should print primary",
"Rank: {id: 1, label: \"Primary\"}",
make_tuple(kRankPrimary)),
"should print primary", "Rank: {id: 1, label: \"Primary\"}", make_tuple(kRankPrimary)),
make_test<string, RankType>(
"should print secondary",
"Rank: {id: 2, label: \"Secondary\"}",
make_tuple(kRankSecondary)),
"should print secondary", "Rank: {id: 2, label: \"Secondary\"}", make_tuple(kRankSecondary)),
make_test<string, RankType>(
"should print tertiary",
"Rank: {id: 3, label: \"Tertiary\"}",
make_tuple(kRankTertiary)),
})
));
"should print tertiary", "Rank: {id: 3, label: \"Tertiary\"}", make_tuple(kRankTertiary)),
})));
}
TestResults test_RankType_operator_equal_to() {
return execute_suite<bool, RankType, RankType>(make_test_suite(
"SBF::RankType::operator==",
[](const RankType& left, const RankType& right) {
return left == right;
},
[](const RankType& left, const RankType& right) { return left == right; },
vector<TestTuple<bool, RankType, RankType>>({
make_test<bool, RankType, RankType>(
"should return true when comparing an rank to itself",
true,
make_tuple(kRankPrimary, kRankPrimary)),
"should return true when comparing an rank to itself", true, make_tuple(kRankPrimary, kRankPrimary)),
make_test<bool, RankType, RankType>(
"should return true when comparing two different instances created with the same values",
true,
make_tuple(kRankSecondary, RankType({kRankSecondaryId, kRankSecondaryLabel}))),
make_test<bool, RankType, RankType>(
"should return false when comparing two different rank gropus",
make_test<bool, RankType, RankType>("should return false when comparing two different rank gropus",
false,
make_tuple(kRankPrimary, kRankTertiary)),
})
));
})));
}
TestResults test_RankType_operator_not_equal_to() {
return execute_suite<bool, RankType, RankType>(make_test_suite(
"SBF::RankType::operator!=",
[](const RankType& left, const RankType& right) {
return left != right;
},
[](const RankType& left, const RankType& right) { return left != right; },
vector<TestTuple<bool, RankType, RankType>>({
make_test<bool, RankType, RankType>(
"should return false when comparing an rank to itself",
false,
make_tuple(kRankPrimary, kRankPrimary)),
"should return false when comparing an rank to itself", false, make_tuple(kRankPrimary, kRankPrimary)),
make_test<bool, RankType, RankType>(
"should return false when comparing two different instances created with the same values",
false,
make_tuple(kRankSecondary, RankType({kRankSecondaryId, kRankSecondaryLabel}))),
make_test<bool, RankType, RankType>(
"should return true when comparing two different rank gropus",
make_test<bool, RankType, RankType>("should return true when comparing two different rank gropus",
true,
make_tuple(kRankSecondary, kRankTertiary)),
})
));
}
})));
}
} // namespace Test::Ranks

View File

@@ -1,25 +1,19 @@
#define _XOPEN_SOURCE_EXTENDED
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdint>
#include <vector>
#include "Utils.h"
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include "test.h"
using namespace SBF;
using namespace Test;
namespace SBF {
using std::cout;
using std::tuple;
using std::wcerr;
using std::string;
using std::endl;
using std::pair;
using std::get;
using std::make_tuple;
using std::vector;
string word_wrap(const string& text, const size_t max_width) {
string output = "";

View File

@@ -55,5 +55,6 @@ namespace SBF {
/// @return The repeated string.
string string_dollar(const size_t length, const char ch);
} // End namespace SBF
/** @}*/
#endif // End !defined UTILS_H__

View File

@@ -1,9 +1,11 @@
#include "Utils.h"
#include "test.h"
#include <string>
#include <tuple>
#include <vector>
#include "test.h"
using namespace SBF;
using namespace Test;
using namespace std;
@@ -16,6 +18,7 @@ TestResults test_make_fit_l();
TestResults test_string_dollar();
TestResults test_word_wrap();
} // End namespace Test::Utils
using namespace Test::Utils;
TestResults main_test_Utils(int argc, char** argv) {
@@ -33,17 +36,20 @@ TestResults main_test_Utils(int argc, char** argv) {
namespace Test::Utils {
TestResults test_get_index_of() {
string long_text = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.";
string long_text =
"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's "
"standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to "
"make a type specimen book. It has survived not only five centuries, but also the leap into electronic "
"typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset "
"sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker "
"including versions of Lorem Ipsum.";
return execute_suite<size_t, string, string, size_t>(make_test_suite(
"SBF::get_index_of",
get_index_of,
vector<TestTuple<size_t, string, string, size_t>>({
make_test<size_t, string, string, size_t>(
"should get 0 for the first word in a string",
0,
make_tuple(long_text, string("Lorem"), size_t(0))),
make_test<size_t, string, string, size_t>(
"should get the location of a word in the larger string",
"should get 0 for the first word in a string", 0, make_tuple(long_text, string("Lorem"), size_t(0))),
make_test<size_t, string, string, size_t>("should get the location of a word in the larger string",
22,
make_tuple(long_text, string("dummy"), size_t(0))),
make_test<size_t, string, string, size_t>(
@@ -58,20 +64,16 @@ TestResults test_get_index_of() {
"should get -1 for the location of a word that is before start location in the string",
-1,
make_tuple(long_text, string("dummy"), size_t(long_text.size()))),
make_test<size_t, string, string, size_t>(
"should get the location of a word within a simple string",
make_test<size_t, string, string, size_t>("should get the location of a word within a simple string",
6,
make_tuple(string("these are words"), string("are"), size_t(0))),
make_test<size_t, string, string, size_t>(
"should get the first location of a word within the string",
make_test<size_t, string, string, size_t>("should get the first location of a word within the string",
4,
make_tuple(string("one two one two"), string("two"), size_t(0))),
make_test<size_t, string, string, size_t>(
"should get the second location of a word within the string",
make_test<size_t, string, string, size_t>("should get the second location of a word within the string",
12,
make_tuple(string("one two one two"), string("two"), size_t(5))),
})
));
})));
}
TestResults test_get_substring() {
@@ -80,35 +82,21 @@ TestResults test_get_substring() {
get_substring,
vector<TestTuple<string, string, size_t, size_t>>({
make_test<string, string, size_t, size_t>(
"should get an empty string if start is too big",
"",
make_tuple(string("asdf"), size_t(6), size_t(2))),
"should get an empty string if start is too big", "", make_tuple(string("asdf"), size_t(6), size_t(2))),
make_test<string, string, size_t, size_t>(
"should get an empty string if count is 0",
"",
make_tuple(string("asdf"), size_t(0), size_t(0))),
"should get an empty string if count is 0", "", make_tuple(string("asdf"), size_t(0), size_t(0))),
make_test<string, string, size_t, size_t>(
"should get a string that starts at 0",
"as",
make_tuple(string("asdf"), size_t(0), size_t(2))),
"should get a string that starts at 0", "as", make_tuple(string("asdf"), size_t(0), size_t(2))),
make_test<string, string, size_t, size_t>(
"should get the whole string",
"asdf",
make_tuple(string("asdf"), size_t(0), size_t(4))),
make_test<string, string, size_t, size_t>(
"should get a partial string if count is too big",
"should get the whole string", "asdf", make_tuple(string("asdf"), size_t(0), size_t(4))),
make_test<string, string, size_t, size_t>("should get a partial string if count is too big",
"asdf",
make_tuple(string("asdf"), size_t(0), size_t(8))),
make_test<string, string, size_t, size_t>(
"should get a substring",
"234",
make_tuple(string("1234567890"), size_t(1), size_t(3))),
"should get a substring", "234", make_tuple(string("1234567890"), size_t(1), size_t(3))),
make_test<string, string, size_t, size_t>(
"should get a word",
"Paris",
make_tuple(string("Where is Paris?"), size_t(9), size_t(5))),
})
));
"should get a word", "Paris", make_tuple(string("Where is Paris?"), size_t(9), size_t(5))),
})));
}
TestResults test_left() {
@@ -117,27 +105,18 @@ TestResults test_left() {
SBF::left,
vector<TestTuple<string, string, size_t>>({
make_test<string, string, size_t>(
"should get a substring",
"Micro",
make_tuple(string("Microsoft QBasic"), size_t(5))),
make_test<string, string, size_t>(
"should get the whole string if length is equal to text.size()",
"should get a substring", "Micro", make_tuple(string("Microsoft QBasic"), size_t(5))),
make_test<string, string, size_t>("should get the whole string if length is equal to text.size()",
"Microsoft QBasic",
make_tuple(string("Microsoft QBasic"), size_t(16))),
make_test<string, string, size_t>(
"should get the whole string if length is greater than text.size()",
make_test<string, string, size_t>("should get the whole string if length is greater than text.size()",
"Microsoft QBasic",
make_tuple(string("Microsoft QBasic"), size_t(20))),
make_test<string, string, size_t>(
"should get an empty string if length is 0",
"",
make_tuple(string("Microsoft QBasic"), size_t(0))),
"should get an empty string if length is 0", "", make_tuple(string("Microsoft QBasic"), size_t(0))),
make_test<string, string, size_t>(
"should get an empty string if text is empty",
"",
make_tuple(string(""), size_t(1))),
})
));
"should get an empty string if text is empty", "", make_tuple(string(""), size_t(1))),
})));
}
TestResults test_make_fit_l() {
@@ -146,27 +125,17 @@ TestResults test_make_fit_l() {
make_fit_l,
vector<TestTuple<string, string, int32_t, char>>({
make_test<string, string, int32_t, char>(
"should truncate a string that is too long",
"Micro",
make_tuple(string("Microsoft QBasic"), 5, 'A')),
"should truncate a string that is too long", "Micro", make_tuple(string("Microsoft QBasic"), 5, 'A')),
make_test<string, string, int32_t, char>(
"should pad a string that is too short",
"MicroAAAAA",
make_tuple(string("Micro"), 10, 'A')),
"should pad a string that is too short", "MicroAAAAA", make_tuple(string("Micro"), 10, 'A')),
make_test<string, string, int32_t, char>(
"should return a string that is perfectly sized",
"Micro",
make_tuple(string("Micro"), 5, 'A')),
make_test<string, string, int32_t, char>(
"should pad the string with spaces if padCh is the null character",
"should return a string that is perfectly sized", "Micro", make_tuple(string("Micro"), 5, 'A')),
make_test<string, string, int32_t, char>("should pad the string with spaces if padCh is the null character",
"Micro ",
make_tuple(string("Micro"), 10, '\0')),
make_test<string, string, int32_t, char>(
"should return a padded string even if text is empty",
"ZZZZZZZZZZ",
make_tuple(string(""), 10, 'Z')),
})
));
"should return a padded string even if text is empty", "ZZZZZZZZZZ", make_tuple(string(""), 10, 'Z')),
})));
}
TestResults test_string_dollar() {
@@ -174,21 +143,13 @@ TestResults test_string_dollar() {
"SBF::string_dollar",
string_dollar,
vector<TestTuple<string, size_t, char>>({
make_test<string, size_t, char>("should make a string", "YYYYY", make_tuple(size_t(5), 'Y')),
make_test<string, size_t, char>(
"should make a string",
"YYYYY",
make_tuple(size_t(5), 'Y')),
make_test<string, size_t, char>(
"should make a string of spaces if ch is the null character",
" ",
make_tuple(size_t(5), '\0')),
make_test<string, size_t, char>(
"should make an empty string if length is 0",
"",
make_tuple(size_t(0), 'C')),
})
));
"should make a string of spaces if ch is the null character", " ", make_tuple(size_t(5), '\0')),
make_test<string, size_t, char>("should make an empty string if length is 0", "", make_tuple(size_t(0), 'C')),
})));
}
// string word_wrap(const string& text, int maxWidth);
TestResults test_word_wrap() {
return execute_suite<string, string, int32_t>(make_test_suite(
@@ -196,31 +157,22 @@ TestResults test_word_wrap() {
word_wrap,
vector<TestTuple<string, string, int32_t>>({
make_test<string, string, int32_t>(
"should return the string if it is shorter than max_width",
"0123_",
make_tuple(string("0123"), 5)),
"should return the string if it is shorter than max_width", "0123_", make_tuple(string("0123"), 5)),
make_test<string, string, int32_t>(
"should return the string if its length is equal to max_width",
"01234",
make_tuple(string("01234"), 5)),
make_test<string, string, int32_t>(
"should wrap a string to two lines if it has no whitespace",
"should return the string if its length is equal to max_width", "01234", make_tuple(string("01234"), 5)),
make_test<string, string, int32_t>("should wrap a string to two lines if it has no whitespace",
"01234\n5____",
make_tuple(string("012345"), 5)),
make_test<string, string, int32_t>(
"should wrap a string to three lines if it has no whitespace",
make_test<string, string, int32_t>("should wrap a string to three lines if it has no whitespace",
"01234\n56789\n0____",
make_tuple(string("01234567890"), 5)),
make_test<string, string, int32_t>(
"should wrap a string with even spacing",
make_test<string, string, int32_t>("should wrap a string with even spacing",
"01 23\n45 67\n89 01",
make_tuple(string("01 23 45 67 89 01"), 5)),
make_test<string, string, int32_t>(
"should collapse whitespace to a single space",
make_test<string, string, int32_t>("should collapse whitespace to a single space",
"01 34\n67 90\n23 56\n89___",
make_tuple(string("01 34 67 90 23 56 89 "), 5)),
// TODO: Treat newlines and tabs in text as spaces.
})
));
})));
}
} // End namespace Test::Utils

View File

@@ -1,4 +1,5 @@
#include "Virtues.h"
#include <string>
#include <vector>
@@ -10,6 +11,7 @@ const std::string GetVirtueLabel(int id) {
}
return "";
}
void FillVirtueLabels(std::vector<std::string>& labels) {
labels.clear();
for (int id = 1; id <= kVirtuesCount; id++) {

View File

@@ -40,5 +40,6 @@ namespace SBF {
/// @param virtue_labels The vector to fill. It will be cleared first.
void FillVirtueLabels(std::vector<std::string>& virtue_labels);
} // End namespace SBF
/** @}*/
#endif // End !defined VIRTUES_H__

View File

@@ -1,8 +1,10 @@
#include "Virtues.h"
#include "test.h"
#include <string>
#include <vector>
#include <tuple>
#include <vector>
#include "test.h"
using namespace SBF;
using namespace Test;
@@ -12,6 +14,7 @@ namespace Test::Virtues {
TestResults test_GetVirtueLabel();
TestResults test_FillVirtueLabels();
} // End namespace Test::Virtues
using namespace Test::Virtues;
TestResults main_test_Virtues(int argc, char** argv) {
@@ -29,28 +32,12 @@ TestResults test_GetVirtueLabel() {
"SBF::GetVirtueLabel",
GetVirtueLabel,
vector<TestTuple<string, int>>({
make_test<string, int>(
"should get \"\" for invalid virtue id 0",
"",
make_tuple(0)),
make_test<string, int>(
"should get \"Self-Control\" for virtue id 1",
"Self-Control",
make_tuple(1)),
make_test<string, int>(
"should get \"Courage\" for virtue id 2",
"Courage",
make_tuple(2)),
make_test<string, int>(
"should get \"Conscience\" for virtue id 3",
"Conscience",
make_tuple(3)),
make_test<string, int>(
"should get \"\" for invalid virtue id 4",
"",
make_tuple(4)),
})
));
make_test<string, int>("should get \"\" for invalid virtue id 0", "", make_tuple(0)),
make_test<string, int>("should get \"Self-Control\" for virtue id 1", "Self-Control", make_tuple(1)),
make_test<string, int>("should get \"Courage\" for virtue id 2", "Courage", make_tuple(2)),
make_test<string, int>("should get \"Conscience\" for virtue id 3", "Conscience", make_tuple(3)),
make_test<string, int>("should get \"\" for invalid virtue id 4", "", make_tuple(4)),
})));
}
TestResults test_FillVirtueLabels() {
@@ -70,16 +57,11 @@ TestResults test_FillVirtueLabels() {
}
return "no errors";
};
return execute_suite<string>(make_test_suite(
"SBF::FillVirtueLabels",
return execute_suite<string>(make_test_suite("SBF::FillVirtueLabels",
fnToTest,
vector<TestTuple<string>>({
make_test<string>(
"should fill ranks",
"no errors",
make_tuple()),
})
));
make_test<string>("should fill ranks", "no errors", make_tuple()),
})));
}
} // End namespace Test::Virtues

View File

@@ -1,7 +1,8 @@
#define _XOPEN_SOURCE_EXTENDED
#include <ncursesw/curses.h>
#include <iostream>
#include <cstdio>
#include <iostream>
#include <string>
#define KEY_ESCAPE 0033
@@ -58,18 +59,18 @@ int main(int argc, char* argv[]) {
// Draw a box around the window with default chars.
set_double_border(pWindow);
// Display the event
mvwaddwstr(pWindow, 2, 2, "Resized");
mvwaddstr(pWindow, 2, 2, "Resized");
// Get the window width and height.
int width;
int height;
getmaxyx(pWindow, height, width);
// Display the width and height.
swprintf(buffer, sizeof(buffer), "width: %i, height: %i", width, height);
mvwaddwstr(pWindow, 1, 2, buffer);
snprintf(buffer, sizeof(buffer), "width: %i, height: %i", width, height);
mvwaddstr(pWindow, 1, 2, buffer);
} else {
// Display the keycode of the key that was pressed in hex and octal.
swprintf(buffer, sizeof(buffer), "0x%04X %04o pressed", key, key);
mvwaddwstr(pWindow,2, 2, buffer);
snprintf(buffer, sizeof(buffer), "0x%04X %04o pressed", key, key);
mvwaddstr(pWindow, 2, 2, buffer);
}
wrefresh(pWindow);
key = wgetch(pWindow);

View File

@@ -1,5 +1,6 @@
#ifndef MAIN_H__
#define MAIN_H__
/***************************************************************************************
* @file main.h
*
@@ -12,8 +13,7 @@
/** \addtogroup Unsorted
* @{
*/
namespace SBF {
namespace SBF {}
}
/** @}*/
#endif

View File

@@ -1,8 +1,10 @@
#define _XOPEN_SOURCE_EXTENDED
#define _XOPEN_SOURCE_EXTENDED
#include "sbf.h"
#include <ncursesw/curses.h>
#include <iostream>
#include <cstdio>
#include <iostream>
#include <string>
#define KEY_ESCAPE 0033

View File

@@ -8,10 +8,11 @@
* Copyright 2023 Tom Hicks
* Licensed under the MIT license see the LICENSE file for details.
***************************************************************************************/
#include <string>
#include "Character.h"
#include "Colors.h"
#include "Menus.h"
#include "Character.h"
#include <string>
/** \addtogroup Unsorted
* @{
@@ -21,10 +22,6 @@ namespace SBF {
const int kInitialGeneration = 13;
/*
$Debug
@@ -86,29 +83,29 @@ Sub MainMenu
choice = 0
Do
Cls
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ"
Print "<22> What are you going to do? <20>"
Print "<22> 1 = Character Generator <20>"
Print "<22> 2 = Character Generator for Dummies <20>"
Print "<22> 3 = Combat Computer <20>"
Print "<22> 4 = Dice Roller <20>"
Print "<22> 5 = Random Character Generator <20>"
Print "<22> 6 = <20>"
Print "<22> 7 = Vehicle Generator <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> 0 = End <20>"
Print "<22> <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ"
Print "<22> What are you going to do? <20>"
Print "<22> 1 = Character Generator <20>"
Print "<22> 2 = Character Generator for Dummies <20>"
Print "<22> 3 = Combat Computer <20>"
Print "<22> 4 = Dice Roller <20>"
Print "<22> 5 = Random Character Generator <20>"
Print "<22> 6 = <20>"
Print "<22> 7 = Vehicle Generator <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> 0 = End <20>"
Print "<22> <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ"
choice = GetChoice(0, 7)
Select Case choice
Case 1
@@ -129,29 +126,29 @@ End Sub
' This sub is not called. It is here so it can be copied whenever I need to make a new bordered screen.
Sub BlankScreen
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ"
End Sub
Function GetChoice (min As Integer, max As Integer)
@@ -203,17 +200,11 @@ Function ChooseStringId (labels() As String, style As MenuStyle, count As Intege
ChooseStringId = choice
End Function
Function ChooseStringIdWithValues (labels() As String, values() As Integer, style As MenuStyle, count As Integer, prompt As String)
Cls
Dim mnuItems(1 To count) As MenuItem
Call BuildMenuWithValues(mnuItems(), labels(), values(), count)
Call AdjustMenuStyle(style, mnuItems(), count, FALSE)
Print prompt
Call PrintMenu(mnuItems(), count, style)
choice = GetMenuChoice(mnuItems(), style, count)
If choice = style.randomItemId Then choice = GetRandomMenuItemId(mnuItems(), count)
ChooseStringIdWithValues = choice
End Function
Function ChooseStringIdWithValues (labels() As String, values() As Integer, style As MenuStyle, count As Integer, prompt
As String) Cls Dim mnuItems(1 To count) As MenuItem Call BuildMenuWithValues(mnuItems(), labels(), values(), count) Call
AdjustMenuStyle(style, mnuItems(), count, FALSE) Print prompt Call PrintMenu(mnuItems(), count, style) choice =
GetMenuChoice(mnuItems(), style, count) If choice = style.randomItemId Then choice = GetRandomMenuItemId(mnuItems(),
count) ChooseStringIdWithValues = choice End Function
Function ChooseStringIdWithColors (labels() As String, colors() As Integer, style As MenuStyle, prompt As String)
Cls
@@ -234,11 +225,8 @@ Function ChooseStringIdWithColors (labels() As String, colors() As Integer, styl
ChooseStringIdWithColors = choice
End Function
Function ChooseMenuItemId (items() As MenuItem, style As MenuStyle, count As Integer, prompt As String, ignoreValue As Integer)
Cls
Call AdjustMenuStyle(style, items(), count, ignoreValue)
Print prompt
Call PrintMenu(items(), count, style)
Function ChooseMenuItemId (items() As MenuItem, style As MenuStyle, count As Integer, prompt As String, ignoreValue As
Integer) Cls Call AdjustMenuStyle(style, items(), count, ignoreValue) Print prompt Call PrintMenu(items(), count, style)
choice = GetMenuChoice(items(), style, count)
If choice = style.randomItemId Then choice = GetRandomMenuItemId(items(), count)
ChooseMenuItemId = choice
@@ -269,11 +257,9 @@ Sub CGGetDisciplines (ch As CharacterType)
While disciplinePoints > 0
Cls
Call FillDisciplines(ch, disciplineValues())
discipline = ChooseStringIdWithValues(Disciplines(), disciplineValues(), ms, DISCIPLINES_COUNT, "Which discipline do you want to spend 1 of your " + itos$(disciplinePoints) + " points on?")
Call SetDiscipline(ch, discipline, GetDiscipline(ch, discipline) + 1)
disciplinePoints = disciplinePoints - 1
Wend
End Sub
discipline = ChooseStringIdWithValues(Disciplines(), disciplineValues(), ms, DISCIPLINES_COUNT, "Which
discipline do you want to spend 1 of your " + itos$(disciplinePoints) + " points on?") Call SetDiscipline(ch,
discipline, GetDiscipline(ch, discipline) + 1) disciplinePoints = disciplinePoints - 1 Wend End Sub
Sub CGGetAttributes (ch As CharacterType)
Dim msWithoutValues As MenuStyle
@@ -294,16 +280,11 @@ Sub CGGetAttributes (ch As CharacterType)
groupSum = 0
rankSum = 1
For i = 1 To ATTRIBUTE_GROUPS_COUNT - 1
nextGroup = ChooseMenuItemId(mnuAttributeGroups(), msWithoutValues, ATTRIBUTE_GROUPS_COUNT, "Choose your " + LCase$(Ranks(i).label) + " attribute?", TRUE)
mnuAttributeGroups(nextGroup).isVisible = FALSE
attributeRanks(nextGroup) = i
rankSum = rankSum + i + 1
groupSum = groupSum + nextGroup
Next
' General formula for last choice given 1 to count based indexing is this
' (Sum from 1 to count) - (Sum of all previous choice IDs)
' Sum(1..AllAttributesCount)-Sum(Choice[1]..Choice[AllAttributesCount-1])
lastGroup = rankSum - groupSum
nextGroup = ChooseMenuItemId(mnuAttributeGroups(), msWithoutValues, ATTRIBUTE_GROUPS_COUNT, "Choose your " +
LCase$(Ranks(i).label) + " attribute?", TRUE) mnuAttributeGroups(nextGroup).isVisible = FALSE attributeRanks(nextGroup)
= i rankSum = rankSum + i + 1 groupSum = groupSum + nextGroup Next ' General formula for last choice given 1 to count
based indexing is this ' (Sum from 1 to count) - (Sum of all previous choice IDs) '
Sum(1..AllAttributesCount)-Sum(Choice[1]..Choice[AllAttributesCount-1]) lastGroup = rankSum - groupSum
attributeRanks(lastGroup) = ATTRIBUTE_GROUPS_COUNT
' Spend attribute points
@@ -315,11 +296,9 @@ Sub CGGetAttributes (ch As CharacterType)
ReDim values(1 To count) As Integer
For attrPoints = GetAttributePointsForRank(rank) To 1 Step -1
Call FillAttributeValues(ch, values(), group)
attribute = ChooseStringIdWithValues(attributes(), values(), msWithValues, count, "Which " + LCase$(AttributeGroups(group)) + " attribute do you want to spend 1 of your " + itos$(attrPoints) + " points on?")
Call SetAttributeValue(ch, group, attribute, GetAttributeValue(ch, group, attribute) + 1)
Next
Next
End Sub
attribute = ChooseStringIdWithValues(attributes(), values(), msWithValues, count, "Which " +
LCase$(AttributeGroups(group)) + " attribute do you want to spend 1 of your " + itos$(attrPoints) + " points on?") Call
SetAttributeValue(ch, group, attribute, GetAttributeValue(ch, group, attribute) + 1) Next Next End Sub
Sub CGGetAbilities (ch As CharacterType)
Dim msWithoutValues As MenuStyle
@@ -340,16 +319,11 @@ Sub CGGetAbilities (ch As CharacterType)
groupSum = 0
rankSum = 1
For i = 1 To ABILITY_GROUPS_COUNT - 1
nextAbility = ChooseMenuItemId(mnuAbilityGroups(), msWithoutValues, ABILITY_GROUPS_COUNT, "Choose your " + LCase$(Ranks(i).label) + " ability?", TRUE)
mnuAbilityGroups(nextAbility).isVisible = FALSE
abilityRanks(nextAbility) = i
rankSum = rankSum + i + 1
groupSum = groupSum + nextAbility
Next
' General formula for last choice given 1 to count based indexing is this
' (Sum from 1 to count) - (Sum of all previous choice IDs)
' Sum(1..AllAttributesCount)-Sum(Choice[1]..Choice[AllAttributesCount-1])
lastGroup = rankSum - groupSum
nextAbility = ChooseMenuItemId(mnuAbilityGroups(), msWithoutValues, ABILITY_GROUPS_COUNT, "Choose your " +
LCase$(Ranks(i).label) + " ability?", TRUE) mnuAbilityGroups(nextAbility).isVisible = FALSE abilityRanks(nextAbility) =
i rankSum = rankSum + i + 1 groupSum = groupSum + nextAbility Next ' General formula for last choice given 1 to count
based indexing is this ' (Sum from 1 to count) - (Sum of all previous choice IDs) '
Sum(1..AllAttributesCount)-Sum(Choice[1]..Choice[AllAttributesCount-1]) lastGroup = rankSum - groupSum
abilityRanks(lastGroup) = ABILITY_GROUPS_COUNT
' Spend ability points
@@ -361,11 +335,9 @@ Sub CGGetAbilities (ch As CharacterType)
ReDim values(1 To count) As Integer
For abilityPoints = GetAbilityPointsForRank(rank) To 1 Step -1
Call FillAbilityValues(ch, values(), group)
ability = ChooseStringIdWithValues(abilityNames(), values(), msWithValues, count, "Which " + LCase$(Abilities(i).singular) + " would you like to spend 1 of your " + itos$(abilityPoints) + " points on?")
Call SetAbilityValue(ch, group, ability, GetAbilityValue(ch, group, ability) + 1)
Next
Next
End Sub
ability = ChooseStringIdWithValues(abilityNames(), values(), msWithValues, count, "Which " +
LCase$(Abilities(i).singular) + " would you like to spend 1 of your " + itos$(abilityPoints) + " points on?") Call
SetAbilityValue(ch, group, ability, GetAbilityValue(ch, group, ability) + 1) Next Next End Sub
Sub CGGetBackgrounds (ch As CharacterType)
' Spend background points
@@ -376,11 +348,9 @@ Sub CGGetBackgrounds (ch As CharacterType)
While backgroundPoints > 0
Cls
Call FillBackgrounds(ch, backgroundValues())
background = ChooseStringIdWithValues(Backgrounds(), backgroundValues(), ms, BACKGROUNDS_COUNT, "Which background do you want to spend 1 of your " + itos$(backgroundPoints) + " points on?")
Call SetBackground(ch, background, GetBackground(ch, background) + 1)
backgroundPoints = backgroundPoints - 1
Wend
End Sub
background = ChooseStringIdWithValues(Backgrounds(), backgroundValues(), ms, BACKGROUNDS_COUNT, "Which
background do you want to spend 1 of your " + itos$(backgroundPoints) + " points on?") Call SetBackground(ch,
background, GetBackground(ch, background) + 1) backgroundPoints = backgroundPoints - 1 Wend End Sub
Sub CGGetRoad (ch As CharacterType)
ch.roadName = "Humanity"
@@ -395,12 +365,9 @@ Sub CGSpendVirtuePoints (ch As CharacterType)
Dim values(1 To VIRTUES_COUNT) As Integer
While virtuePoints > 0
Call FillVirtues(ch, values())
virtue = ChooseStringIdWithValues(Virtues(), values(), ms, VIRTUES_COUNT, "Which virtue do you want to spend 1 of your " + itos$(virtuePoints) + " points on?")
If virtue = 0 Then virtue = GetRandomInt(1, VIRTUES_COUNT)
Call SetVirtue(ch, virtue, GetVirtue(ch, virtue) + 1)
virtuePoints = virtuePoints - 1
Wend
End Sub
virtue = ChooseStringIdWithValues(Virtues(), values(), ms, VIRTUES_COUNT, "Which virtue do you want to spend 1
of your " + itos$(virtuePoints) + " points on?") If virtue = 0 Then virtue = GetRandomInt(1, VIRTUES_COUNT) Call
SetVirtue(ch, virtue, GetVirtue(ch, virtue) + 1) virtuePoints = virtuePoints - 1 Wend End Sub
Sub CGGetDerangement (ch As CharacterType)
If ch.clan = CLAN_MALKAVIAN Then
@@ -409,10 +376,8 @@ Sub CGGetDerangement (ch As CharacterType)
Call NewMenuStyle(ms)
ms.useColors = TRUE
ch.derangementId = ChooseStringIdWithColors(DerangementLabels(), DerangementColors(), ms, "Which derangement do you want?")
If ch.derangementId = 0 Then ch.derangementId = GetRandomInt(1, DERANGEMENTS_COUNT)
End If
End Sub
ch.derangementId = ChooseStringIdWithColors(DerangementLabels(), DerangementColors(), ms, "Which derangement do
you want?") If ch.derangementId = 0 Then ch.derangementId = GetRandomInt(1, DERANGEMENTS_COUNT) End If End Sub
Sub CGSpendFreebiePoints (ch As CharacterType)
End Sub
@@ -586,15 +551,15 @@ Sub ShowCharacterSheet (ch As CharacterType)
Call FillBackgrounds(ch, backgroundValues())
'... 0123456789
'160 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'170 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'180 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'190 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'200 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'210 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'220 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'230 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD>
' enquote forms s/^([ɺ<><C9BA><EFBFBD>].*[<5B><><EFBFBD><EFBFBD>])$/print "$1"/g
'160 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'170 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'180 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'190 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'200 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'210 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'220 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
'230 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD>
' enquote forms s/^([ɺ<><C9BA><EFBFBD>].*[<5B><><EFBFBD><EFBFBD>])$/print "$1"/g
Dim disciplineStrings(3) As String
disciplineStringsIndex = 0
@@ -627,47 +592,54 @@ Sub ShowCharacterSheet (ch As CharacterType)
Call MakeWrapLines(derangementStrings(), allDerangementsLine$, 37, 5)
Cls
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ"
Print "<22> Name: " + MakeFitL$(ch.name, 30, " ") + " <20> Gender: " + MakeFitL$(Genders(ch.gender), 14, " ") + " Generation: " + MakeFitR$(itos$(ch.generation), 2, " ") + " <20>"
Print "<22> Clan: " + MakeFitL$(Clans(ch.clan), 30, " ") + " <20> Age: " + MakeFitL$(ch.age$, 32, " ") + " <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹ Player: " + MakeFitL$(ch.player$, 29, " ") + " <20>"
Print "<22> Attributes <20> Chronicle: " + MakeFitL$(ch.chronicle$, 26, " ") + " <20>"
Print "<22> Physical Social Mental <20> Haven: " + MakeFitL$(ch.haven$, 30, " ") + " <20>"
Print "<22> Str. " + MakeFitL$(itos$(ch.attr_strength), 7, " ") + " App. " + MakeFitL$(itos$(ch.attr_appearance), 7, " ") + " Int. " + MakeFitL$(itos$(ch.attr_intelligence), 5, " ") + " <20> Concept: " + MakeFitL$(ch.concept$, 28, " ") + " <20>"
Print "<22> Dex. " + MakeFitL$(itos$(ch.attr_dexterity), 7, " ") + " Cha. " + MakeFitL$(itos$(ch.attr_charisma), 7, " ") + " Per. " + MakeFitL$(itos$(ch.attr_perception), 5, " ") + " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹"
Print "<22> Sta. " + MakeFitL$(itos$(ch.attr_stamina), 7, " ") + " Man. " + MakeFitL$(itos$(ch.attr_manipulation), 7, " ") + " Wit. " + MakeFitL$(itos$(ch.attr_wits), 5, " ") + " <20> Derangements: <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹ " + derangementStrings(0) + " <20>"
Print "<22> Disciplines: <20> " + derangementStrings(1) + " <20>"
Print "<22> " + MakeFitL$(disciplineStrings(0), 36, " ") + " <20> " + MakeFitL$(derangementStrings(2), 37, "_") + " <20>"
Print "<22> " + MakeFitL$(disciplineStrings(1), 36, " ") + " <EFBFBD> " + MakeFitL$(derangementStrings(3), 37, "_") + " <20>"
Print "<22> " + MakeFitL$(disciplineStrings(2), 36, " ") + " <20> " + MakeFitL$(derangementStrings(4), 37, "_") + " <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹"
Print "<22> " + MakeFitL$(ch.roadName + ": " + itos$(ch.roadValue), 36, " ") + " <20> Nature: " + MakeFitL$(Archetypes(ch.nature), 29, " ") + " <20>"
Print "<22> Willpower: " + MakeFitL$(itos$(ch.willpower), 25, " ") + " <20> Demeanor: " + MakeFitL$(Archetypes(ch.demeanor), 27, " ") + " <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <<PRESS ANY KEY TO CONTINUE>> <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ"
Print "<22> Name: " + MakeFitL$(ch.name, 30, " ") + " <20> Gender: " + MakeFitL$(Genders(ch.gender), 14, " ") + "
Generation: " + MakeFitR$(itos$(ch.generation), 2, " ") + " <20>" Print "<22> Clan: " + MakeFitL$(Clans(ch.clan), 30, " ") + "
<EFBFBD> Age: " + MakeFitL$(ch.age$, 32, " ") + " <20>"
Print "<22><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹ Player: " + MakeFitL$(ch.player$, 29, " ") +
" <20>" Print "<22> Attributes <20> Chronicle: " + MakeFitL$(ch.chronicle$, 26, " ") + " <20>" Print "<22>
Physical Social Mental <20> Haven: " + MakeFitL$(ch.haven$, 30, " ") + " <20>" Print "<22> Str. " +
MakeFitL$(itos$(ch.attr_strength), 7, " ") + " App. " + MakeFitL$(itos$(ch.attr_appearance), 7, " ") + " Int. " +
MakeFitL$(itos$(ch.attr_intelligence), 5, " ") + " <EFBFBD> Concept: " + MakeFitL$(ch.concept$, 28, " ") + " <20>" Print "<22> Dex. "
+ MakeFitL$(itos$(ch.attr_dexterity), 7, " ") + " Cha. " + MakeFitL$(itos$(ch.attr_charisma), 7, " ") + " Per. " +
MakeFitL$(itos$(ch.attr_perception), 5, " ") + "
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹"
Print "<22> Sta. " + MakeFitL$(itos$(ch.attr_stamina), 7, " ") + " Man. " + MakeFitL$(itos$(ch.attr_manipulation), 7, "
") + " Wit. " + MakeFitL$(itos$(ch.attr_wits), 5, " ") + " <20> Derangements: <20>" Print
"<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹ " + derangementStrings(0) +
" <20>" Print "<22> Disciplines: <20> " + derangementStrings(1) + " <20>" Print "<22> " +
MakeFitL$(disciplineStrings(0), 36, " ") + " <20> " + MakeFitL$(derangementStrings(2), 37, "_") + " <20>" Print "<22> " +
MakeFitL$(disciplineStrings(1), 36, " ") + " <20> " + MakeFitL$(derangementStrings(3), 37, "_") + " <20>" Print "<22> " +
MakeFitL$(disciplineStrings(2), 36, " ") + " <20> " + MakeFitL$(derangementStrings(4), 37, "_") + " <20>" Print
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹"
Print "<22> " + MakeFitL$(ch.roadName + ": " + itos$(ch.roadValue), 36, " ") + " <20> Nature: " +
MakeFitL$(Archetypes(ch.nature), 29, " ") + " <20>" Print "<22> Willpower: " + MakeFitL$(itos$(ch.willpower), 25, " ") + " <20>
Demeanor: " + MakeFitL$(Archetypes(ch.demeanor), 27, " ") + " <20>" Print
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <20>"
Print "<22> <<PRESS ANY KEY TO CONTINUE>> <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ"
Call PressAnyKeyToContinue
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ"
Print "<22> " + MakeFitC$("Abilities", 76, " ") + " <20>"
Print "<22> " + MakeFitC$("Talents", 25, " ") + " " + MakeFitC$("Skills", 25, " ") + " " + MakeFitC$("Knowledges", 24, " ") + " <20>"
For index = 1 To 10
Print "<22> " + MakeFitC(MakeFitL$(Talents(index) + ":", 14, " ") + itos$(GetTalent(ch, index)), 25, " ") + " " + MakeFitC(MakeFitL$(Skills(index) + ":", 14, " ") + itos$(GetSkill(ch, index)), 25, " ") + " " + MakeFitC(MakeFitL$(Knowledges(index) + ":", 14, " ") + itos$(GetKnowledge(ch, index)), 24, " ") + " <20>"
Next
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹"
Print "<22> Backgrounds: <20> Virtues: <20>"
Print "<22> " + MakeFitL$(backgroundStrings(0), 36, " ") + " <20> " + MakeFitB$("Conscience:", itos$(ch.conscience), 37, " ") + " <20>"
Print "<22> " + MakeFitL$(backgroundStrings(1), 36, " ") + " <20> " + MakeFitB$("Self-Control:", itos$(ch.selfControl), 37, " ") + " <20>"
Print "<22> " + MakeFitL$(backgroundStrings(2), 36, " ") + " <20> " + MakeFitB$("Courage:", itos$(ch.courage), 37, " ") + " <20>"
Print "<22> " + MakeFitL$(backgroundStrings(3), 36, " ") + " <20> " + MakeFitL$("", 37, " ") + " <20>"
Print "<22> " + MakeFitL$(backgroundStrings(4), 36, " ") + " <20> " + MakeFitL$("", 37, " ") + " <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹"
Print "<22> <<PRESS ANY KEY TO CONTINUE>> <20>"
Print "<22><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͻ"
Print "<22> " + MakeFitC$("Abilities", 76, " ") + " <20>"
Print "<22> " + MakeFitC$("Talents", 25, " ") + " " + MakeFitC$("Skills", 25, " ") + " " + MakeFitC$("Knowledges", 24,
" ") + " <20>" For index = 1 To 10 Print "<22> " + MakeFitC(MakeFitL$(Talents(index) + ":", 14, " ") + itos$(GetTalent(ch,
index)), 25, " ") + " " + MakeFitC(MakeFitL$(Skills(index) + ":", 14, " ") + itos$(GetSkill(ch, index)), 25, " ") + " "
+ MakeFitC(MakeFitL$(Knowledges(index) + ":", 14, " ") + itos$(GetKnowledge(ch, index)), 24, " ") + " <20>" Next Print
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹"
Print "<22> Backgrounds: <20> Virtues: <20>"
Print "<22> " + MakeFitL$(backgroundStrings(0), 36, " ") + " <20> " + MakeFitB$("Conscience:", itos$(ch.conscience), 37, "
") + " <20>" Print "<22> " + MakeFitL$(backgroundStrings(1), 36, " ") + " <20> " + MakeFitB$("Self-Control:",
itos$(ch.selfControl), 37, " ") + " <20>" Print "<22> " + MakeFitL$(backgroundStrings(2), 36, " ") + " <20> " +
MakeFitB$("Courage:", itos$(ch.courage), 37, " ") + " <20>" Print "<22> " + MakeFitL$(backgroundStrings(3), 36, " ") + " <20> " +
MakeFitL$("", 37, " ") + " <20>" Print "<22> " + MakeFitL$(backgroundStrings(4), 36, " ") + " <20> " + MakeFitL$("", 37, " ") + "
<EFBFBD>" Print
"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>͹"
Print "<22> <<PRESS ANY KEY TO CONTINUE>> <20>"
Print "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͼ"
Call PressAnyKeyToContinue
End Sub
@@ -698,10 +670,8 @@ Sub Choice6
Print "Unnamed choice 6"
End Sub
' Like the character generator but for vehicles. Much simpler with fewer questions. Prints a vehicle sheet when done. Never finished and crashes mid way through currently.
Sub VehicleGenerator
Print "VehicleGenerator"
End Sub
' Like the character generator but for vehicles. Much simpler with fewer questions. Prints a vehicle sheet when done.
Never finished and crashes mid way through currently. Sub VehicleGenerator Print "VehicleGenerator" End Sub
Sub PressAnyKeyToContinue ()
While InKey$ = "": Wend
@@ -822,5 +792,6 @@ End Sub
*/
} // End namespace SBF
/** #}*/
#endif // End !defined SBF_H__

View File

@@ -1,65 +1,80 @@
#define _XOPEN_SOURCE_EXTENDED
#include <iostream>
#include <cstdio>
#include <string>
#include <cstdint>
#include <vector>
#include "test.h"
#include <cstdint>
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
// using namespace std;
using std::cout;
using std::tuple;
using std::wcerr;
using std::string;
using std::endl;
using std::pair;
using std::get;
using std::make_tuple;
using std::vector;
using Test::TestResults;
using std::optional;
using std::function;
using std::for_each;
// using namespace Test;
namespace Test {
// Test lifecycle
// suiteSetupFn(); - This is called to allocate any suite level resources. This is called once when the suite begins.
// These functions may be called in parallel but execution will not proceed past this block until they have all finished.
// testSetupFn(); - This is called once for every test in tests. You may use it to allocate resources or setup mocks, stubs, and spies.
// testFn(...); - This is called once for every test to execute the test.
// Only one of these test functions will actually be run for each test in tests. They should return true if the test passed, return false if the test failed or there was an error, and be nullptr if they should be skipped. The executed function will be called with expectedOutput and the result of testFn(...). They can be used to test functions with side effects, especially void functions.
// maybe_compare_function; - This is the highest priority compare function. If it is not nullptr then it will be called.
// suite_compare_function; - This is the second highest priority compare function. If maybe_compare_function is nullptr and this is not nullptr then it will be called.
// [](TResult expected, TResult actual) { return expected, actual; } - This is the lowest priority compare function. If all other compare functions are nullptr then this will be called to evaluate the test.
// testTeardownFn(); - This is called once for every test in tests. You must free/release any resources allocated by testSetupFn.
// These functions may be called in parallel but execution will not proceed past this block until they have all
// finished.
// testSetupFn(); - This is called once for every test in tests. You may use it to allocate resources or setup mocks,
// stubs, and spies. testFn(...); - This is called once for every test to execute the test. Only one of these test
// functions will actually be run for each test in tests. They should return true if the test passed, return false if
// the test failed or there was an error, and be nullptr if they should be skipped. The executed function will be
// called with expectedOutput and the result of testFn(...). They can be used to test functions with side effects,
// especially void functions. maybe_compare_function; - This is the highest priority compare function. If it is not
// nullptr then it will be called. suite_compare_function; - This is the second highest priority compare function. If
// maybe_compare_function is nullptr and this is not nullptr then it will be called.
// [](TResult expected, TResult actual) { return expected, actual; } - This is the lowest priority compare function.
// If all other compare functions are nullptr then this will be called to evaluate the test. testTeardownFn(); - This
// is called once for every test in tests. You must free/release any resources allocated by testSetupFn.
// This ends the parallel test functions section all tests will have completed before execution proceeds.
// Collect reports - Ths step is not visible to the user at this point, but data returned by all of the test functions is collected here. This is where you will eventually be able to format/log data for reports.
// suiteTeardownFn(); - This is called after all test calls have completed, all testTeardownFn calls have completed, and all test reports/logs have been written. You should free any resources allocated in suiteSetupFn.
// Collect reports - Ths step is not visible to the user at this point, but data returned by all of the test functions
// is collected here. This is where you will eventually be able to format/log data for reports. suiteTeardownFn(); -
// This is called after all test calls have completed, all testTeardownFn calls have completed, and all test
// reports/logs have been written. You should free any resources allocated in suiteSetupFn.
// TODO: Add TShared(*)(string /*test_name*/, UUID /*testRunId*/) allocateSharedData to the test tuple to make some shared data that can be used in a thread safe way by setup, teardown, and evaluate steps of the test.
// TODO: Add TShared(*)(string /*test_name*/, UUID /*testRunId*/) allocateSharedData to the test tuple to make some
// shared data that can be used in a thread safe way by setup, teardown, and evaluate steps of the test.
// TODO: Add TShared to be returned by the setup functions, and consumed by the evaluate and teardown functions.
// Suite setup/teardown functions should allocate/free.
// Test setup/teardown functions should consume the data allocated by Suite setup.
// Test setup functions may allocate additional resources. If they do then the allocated resources they should be freed by test teardown function.
// Suite and/or Test compare functions may consume this shared data, but it will not be shared with the execution of testFn.
// Test setup functions may allocate additional resources. If they do then the allocated resources they should be
// freed by test teardown function. Suite and/or Test compare functions may consume this shared data, but it will not
// be shared with the execution of testFn.
// This function is called to execute a test suite. You provide it with some configuration info, optional utility callback functions, and test data (input parameters for each call to testFn and the expected result). It returns a TestResults that should be treated as an opaque data type.
// Not all parameters are named in code, but they are named and explained in the comments and will be described by those names below.
// This function is called to execute a test suite. You provide it with some configuration info, optional utility
// callback functions, and test data (input parameters for each call to testFn and the expected result). It returns a
// TestResults that should be treated as an opaque data type. Not all parameters are named in code, but they are named
// and explained in the comments and will be described by those names below.
// string suite_label - This is the name of this test suite. It is used for reporting messages.
// FnToTest testFn - This is the function to test. This may be replaced if necessary by function. It may not currently support class methods, but that is planned.
// vector<tuple<...>> tests - This is the test run data. Each tuple in the vector is a single test run. It's members are explained below.
// FnToTest testFn - This is the function to test. This may be replaced if necessary by function. It may not currently
// support class methods, but that is planned. vector<tuple<...>> tests - This is the test run data. Each tuple in the
// vector is a single test run. It's members are explained below.
// string test_name - This is the name of this test. It is used for reporting messages.
// TResult expectedOutput - This is the expected result of executing this test.
// bool(*)(const TResult expected, const TResult actual) maybe_compare_function - This is optional. If unset or set to nullptr it is skipped. If set to a function it is called to evaluate the test results. It takes the expected and actual results as parameters and should return true if the test passed and false otherwise. This may be changed to return a TestResults at some point.
// void(*)(TInputParams...) testSetupFn - This is optional. If unset or set to nullptr it is skipped. If set to a function it is called before each test to setup the environment for the test. You may use it to allocate resources and setup mocks, stubs, and spies.
// void(*)(TInputParams...) testTeardownFn - This is optiona. If unset or set to nullptr it is skipped. If set to a function it is called after each test to cleanup the environment after the test. You should free resources allocated by testSetupFn.
// bool isEnabled - This is optional. If unset or set to true the test is run. If set to false this test is skipped. If skipped it will be reported as a skipped/disabled test.
// bool(*)(const TResult expected, const TResult actual) suite_compare_function - This is optional. If unset or set to nullptr it is skipped. If set to a function and maybe_compare_function is not called for a test run then this function is called to evaluate the test results. It takes the expected and actual results as parameters and should return true if the test passed and false otherwise. This may be changed to return a TestResults at some point.
// void(*)() suiteSetupFn - This is optional. If unset or set to nullptr it is skipped. If set to a function it is called before starting this test suite to setup the environment. You may use it to allocate resources and setup mocks, stubs, and spies.
// void(*)() suiteTeardownFn - This is optional. If unset or set to nullptr it is skipped. If set to a function it is called after all tests in this suite have finished and all reporting has finished. You should free resources allocated by suiteSetupFn.
// This method should be called like so. This is the minimal call and omits all of the optional params. This is the most common usage. You should put one tuple of inputs and expected output for each test case.
// bool(*)(const TResult expected, const TResult actual) maybe_compare_function - This is optional. If unset or set
// to nullptr it is skipped. If set to a function it is called to evaluate the test results. It takes the expected
// and actual results as parameters and should return true if the test passed and false otherwise. This may be
// changed to return a TestResults at some point. void(*)(TInputParams...) testSetupFn - This is optional. If unset
// or set to nullptr it is skipped. If set to a function it is called before each test to setup the environment for
// the test. You may use it to allocate resources and setup mocks, stubs, and spies. void(*)(TInputParams...)
// testTeardownFn - This is optiona. If unset or set to nullptr it is skipped. If set to a function it is called
// after each test to cleanup the environment after the test. You should free resources allocated by testSetupFn.
// bool isEnabled - This is optional. If unset or set to true the test is run. If set to false this test is skipped.
// If skipped it will be reported as a skipped/disabled test.
// bool(*)(const TResult expected, const TResult actual) suite_compare_function - This is optional. If unset or set to
// nullptr it is skipped. If set to a function and maybe_compare_function is not called for a test run then this
// function is called to evaluate the test results. It takes the expected and actual results as parameters and should
// return true if the test passed and false otherwise. This may be changed to return a TestResults at some point.
// void(*)() suiteSetupFn - This is optional. If unset or set to nullptr it is skipped. If set to a function it is
// called before starting this test suite to setup the environment. You may use it to allocate resources and setup
// mocks, stubs, and spies. void(*)() suiteTeardownFn - This is optional. If unset or set to nullptr it is skipped. If
// set to a function it is called after all tests in this suite have finished and all reporting has finished. You
// should free resources allocated by suiteSetupFn.
// This method should be called like so. This is the minimal call and omits all of the optional params. This is the most
// common usage. You should put one tuple of inputs and expected output for each test case.
// results = collect_and_report_TestResultstest_fn(
// "Test: functionUnderTest",
// functionUnderTest,
@@ -71,16 +86,20 @@ namespace Test {
// ),
// }),
// );
// The suites can be run from one file as such. From a file called ThingDoer_test.cpp to test the class/methods ThingDoer declared in ThingDoer.cpp. This isn't mandatory but is a best practice.
// You can use testFn without calling collect_and_report_TestResults() and also could call it from a normal int main(int argc, char** argv) or other function.
// The suites can be run from one file as such. From a file called ThingDoer_test.cpp to test the class/methods
// ThingDoer declared in ThingDoer.cpp. This isn't mandatory but is a best practice. You can use testFn without calling
// collect_and_report_TestResults() and also could call it from a normal int main(int argc, char** argv) or other
// function.
// TestResults test_main_ThingDoer(int argc, char** argv) {
// TestResults results;
// results = collect_and_report_TestResults(results, testFn("doThing1", ...), argc, argv);
// results = collect_and_report_TestResults(results, testFn("doThing2", ...), argc, argv);
// return results;
// }
// Then some test harness either generated or explicit can call test_main_ThingDoer(...) and optionally reported there. Reporting granularity is controlled by how frequently you call collect_and_report_TestResults(...).
// You can combine test results with results = results + testFn(..); and then collect_and_report_TestResults on the aggregate TestResults value.
// Then some test harness either generated or explicit can call test_main_ThingDoer(...) and optionally reported there.
// Reporting granularity is controlled by how frequently you call collect_and_report_TestResults(...). You can combine
// test results with results = results + testFn(..); and then collect_and_report_TestResults on the aggregate
// TestResults value.
// _Step_9 - if T2 is a single value then make_tuple<T2>(T2) and call longer version
// auto testFunction = [](int id){return id==0?"":"";};
@@ -92,32 +111,34 @@ namespace Test {
// Default to (string, _FnToTest, vector<tuple<"", _T1, [](a,b){return a==b;}, make_tuple())
// Also allow make_tuple(T2) if the last param is not a tuple.
TestResults::TestResults()
: errors_(0)
, failed_(0)
, passed_(0)
, skipped_(0)
, total_(0) {}
TestResults::TestResults() : errors_(0), failed_(0), passed_(0), skipped_(0), total_(0) {}
TestResults::TestResults(const TestResults& other)
: error_messages_(other.error_messages_)
, errors_(other.errors_)
, failed_(other.failed_)
, failure_messages_(other.failure_messages_)
, passed_(other.passed_)
, skip_messages_(other.skip_messages_)
, skipped_(other.skipped_)
, total_(other.total_) {}
: error_messages_(other.error_messages_),
errors_(other.errors_),
failed_(other.failed_),
failure_messages_(other.failure_messages_),
passed_(other.passed_),
skip_messages_(other.skip_messages_),
skipped_(other.skipped_),
total_(other.total_) {}
TestResults::TestResults(uint32_t errors, uint32_t failed, uint32_t passed, uint32_t skipped, uint32_t total, vector<string> error_messages, vector<string> failure_messages, vector<string> skip_messages)
: error_messages_(error_messages)
, errors_(errors)
, failed_(failed)
, failure_messages_(failure_messages)
, passed_(passed)
, skip_messages_(skip_messages)
, skipped_(skipped)
, total_(total) {}
TestResults::TestResults(uint32_t errors,
uint32_t failed,
uint32_t passed,
uint32_t skipped,
uint32_t total,
vector<string> error_messages,
vector<string> failure_messages,
vector<string> skip_messages)
: error_messages_(error_messages),
errors_(errors),
failed_(failed),
failure_messages_(failure_messages),
passed_(passed),
skip_messages_(skip_messages),
skipped_(skipped),
total_(total) {}
TestResults& TestResults::error() {
errors_++;
@@ -205,8 +226,7 @@ namespace Test {
skip_messages.insert(skip_messages.end(), skip_messages_.begin(), skip_messages_.end());
skip_messages.insert(skip_messages.end(), other.skip_messages_.begin(), other.skip_messages_.end());
return TestResults(
errors_ + other.errors_,
return TestResults(errors_ + other.errors_,
failed_ + other.failed_,
passed_ + other.passed_,
skipped_ + other.skipped_,

View File

@@ -10,25 +10,34 @@
***************************************************************************************/
#include <cstdint>
#include <tuple>
#include <utility>
#include <string>
#include <iostream>
#include <sstream>
#include <string>
#include <tuple>
#include <utility>
// Test lifecycle
// suite_setup_function(); - This is called to allocate any suite level resources. This is called once when the suite begins.
// These functions may be called in parallel but execution will not proceed past this block until they have all finished.
// test_setup_function(); - This is called once for every test in tests. You may use it to allocate resources or setup mocks, stubs, and spies.
// function_to_test(...); - This is called once for every test to execute the test.
// Only one of these test functions will actually be run for each test in tests. They should return true if the test passed, return false if the test failed or there was an error, and be nullptr if they should be skipped. The executed function will be called with expected_output and the result of function_to_test(...). They can be used to test functions with side effects, especially void functions.
// test_compare_function; - This is the highest priority compare function. If it is not nullptr then it will be called.
// suite_compare_function; - This is the second highest priority compare function. If test_compare_function is nullptr and this is not nullptr then it will be called.
// [](TResult expected, TResult actual) { return expected, actual; } - This is the lowest priority compare function. If all other compare functions are nullptr then this will be called to evaluate the test.
// test_teardown_function(); - This is called once for every test in tests. You must free/release any resources allocated by test_setup_function.
// suite_setup_function(); - This is called to allocate any suite level resources. This is called once when the suite
// begins. These functions may be called in parallel but execution will not proceed past this block until they have all
// finished.
// test_setup_function(); - This is called once for every test in tests. You may use it to allocate resources or setup
// mocks, stubs, and spies. function_to_test(...); - This is called once for every test to execute the test. Only one
// of these test functions will actually be run for each test in tests. They should return true if the test passed,
// return false if the test failed or there was an error, and be nullptr if they should be skipped. The executed
// function will be called with expected_output and the result of function_to_test(...). They can be used to test
// functions with side effects, especially void functions. test_compare_function; - This is the highest priority
// compare function. If it is not nullptr then it will be called. suite_compare_function; - This is the second highest
// priority compare function. If test_compare_function is nullptr and this is not nullptr then it will be called.
// [](TResult expected, TResult actual) { return expected, actual; } - This is the lowest priority compare function.
// If all other compare functions are nullptr then this will be called to evaluate the test. test_teardown_function();
// - This is called once for every test in tests. You must free/release any resources allocated by
// test_setup_function.
// This ends the parallel test functions section all tests will have completed before execution proceeds.
// Collect reports - Ths step is not visible to the user at this point, but data returned by all of the test functions is collected here. This is where you will eventually be able to format/log data for reports.
// suite_teardown_function(); - This is called after all test calls have completed, all test_teardown_function calls have completed, and all test reports/logs have been written. You should free any resources allocated in suite_setup_function.
// Collect reports - Ths step is not visible to the user at this point, but data returned by all of the test functions
// is collected here. This is where you will eventually be able to format/log data for reports.
// suite_teardown_function(); - This is called after all test calls have completed, all test_teardown_function calls
// have completed, and all test reports/logs have been written. You should free any resources allocated in
// suite_setup_function.
// Tuple printer from: https://stackoverflow.com/questions/6245735/pretty-print-stdtuple/31116392#58417285
template <typename TChar, typename TTraits, typename... TArgs>
@@ -51,7 +60,9 @@ auto& operator<<(std::basic_ostream<TChar, TTraits>& os, std::vector<TItem> v) {
}
template <typename TChar, typename TTraits, typename TItem>
auto& compare(std::basic_ostream<TChar, TTraits>& error_message, std::vector<TItem> expected, std::vector<TItem> actual) {
auto& compare(std::basic_ostream<TChar, TTraits>& error_message,
std::vector<TItem> expected,
std::vector<TItem> actual) {
if (expected.size() != actual.size()) {
error_message << "size mismatch expected: " << expected.size() << ", actual: " << actual.size();
return error_message;
@@ -59,10 +70,8 @@ auto& compare(std::basic_ostream<TChar, TTraits>& error_message, std::vector<TIt
for (size_t index = 0; index < expected.size(); index++) {
if (expected[index] != actual[index]) {
error_message << "vectors differ at index " << index
<< ", \"" << expected[index] << "\" != \"" << actual[index]
<< "\", expected: \"" << expected
<< "\", actual: \"" << actual << "\"";
error_message << "vectors differ at index " << index << ", \"" << expected[index] << "\" != \"" << actual[index]
<< "\", expected: \"" << expected << "\", actual: \"" << actual << "\"";
return error_message;
}
}
@@ -70,10 +79,9 @@ auto& compare(std::basic_ostream<TChar, TTraits>& error_message, std::vector<TIt
}
namespace Test {
using std::tuple;
using std::pair;
using std::vector;
using std::string;
using std::tuple;
using std::vector;
/// @brief
class TestResults {
@@ -94,7 +102,14 @@ namespace Test {
/// @param error_messages The list of error messages.
/// @param failure_messages The list of failure messages.
/// @param skip_messages The list of skip messages.
TestResults(uint32_t errors, uint32_t failed, uint32_t passed, uint32_t skipped, uint32_t total, std::vector<std::string> error_messages, std::vector<std::string> failure_messages, std::vector<std::string> skip_messages);
TestResults(uint32_t errors,
uint32_t failed,
uint32_t passed,
uint32_t skipped,
uint32_t total,
std::vector<std::string> error_messages,
std::vector<std::string> failure_messages,
std::vector<std::string> skip_messages);
/// @brief Adds an error. This increments errors.
/// @return A reference to this instance. Used for chaining.
@@ -198,13 +213,25 @@ namespace Test {
/// @tparam TResult
/// @tparam ...TInputParams
template <typename TResult, typename... TInputParams>
using TestTuple = std::tuple<
std::string /* test_name */,
using TestTuple =
std::tuple<std::string /* test_name */,
TResult /* expected_output */,
std::tuple<TInputParams...> /* input_params - The input parameters for this test. These will be used when calling std::apply with function_to_test to execute the test. */,
MaybeTestCompareFunction<TResult> /* test_compare_function - If this is not nullprt then this function will be called instead of suite_compare_function to determine if the test passes. Use this to check for side effects of the test. Return true if the test passes and false otherwise. */,
MaybeTestConfigureFunction /* test_setup_function - If this is not nullptr this function is called before each test to setup the environment. It is called with std::apply and input_params so you can use them to mock records with specific IDs or calculate an expected result. */,
MaybeTestConfigureFunction /* test_teardown_function If this is not nullptr this function is called after each test to cleanup any allocated/shared resources. */,
std::tuple<TInputParams...> /* input_params - The input parameters for this test. These will be used when
calling std::apply with function_to_test to execute the test. */
,
MaybeTestCompareFunction<TResult> /* test_compare_function - If this is not nullprt then this function
will be called instead of suite_compare_function to determine if the
test passes. Use this to check for side effects of the test. Return
true if the test passes and false otherwise. */
,
MaybeTestConfigureFunction /* test_setup_function - If this is not nullptr this function is called before
each test to setup the environment. It is called with std::apply and
input_params so you can use them to mock records with specific IDs or
calculate an expected result. */
,
MaybeTestConfigureFunction /* test_teardown_function If this is not nullptr this function is called after
each test to cleanup any allocated/shared resources. */
,
bool /* is_enabled If this is false the test, setup, and teardown functions are not run. */>;
/// @brief
@@ -212,31 +239,45 @@ namespace Test {
/// @tparam TFunctionToTest
/// @tparam ...TInputParams
template <typename TResult, typename... TInputParams>
using TestSuite = std::tuple<
std::string,
using TestSuite = std::tuple<std::string,
std::function<TResult(TInputParams...)>,
std::vector<TestTuple<TResult, TInputParams...>>,
MaybeTestCompareFunction<TResult>,
MaybeTestConfigureFunction,
MaybeTestConfigureFunction,
bool
>;
bool>;
// This function is called to execute a test suite. You provide it with some configuration info, optional utility callback functions, and test data (input parameters for each call to function_to_test and the expected result). It returns a TestResults that should be treated as an opaque data type.
// Not all parameters are named in code, but they are named and explained in the comments and will be described by those names below.
// This function is called to execute a test suite. You provide it with some configuration info, optional utility
// callback functions, and test data (input parameters for each call to function_to_test and the expected result). It
// returns a TestResults that should be treated as an opaque data type. Not all parameters are named in code, but they
// are named and explained in the comments and will be described by those names below.
// string suite_name - This is the name of this test suite. It is used for reporting messages.
// TFunctionToTest function_to_test - This is the function to test. This may be replaced if necessary by std::function. It may not currently support class methods, but that is planned.
// vector<tuple<...>> tests - This is the test run data. Each tuple in the vector is a single test run. It's members are explained below.
// TFunctionToTest function_to_test - This is the function to test. This may be replaced if necessary by
// std::function. It may not currently support class methods, but that is planned. vector<tuple<...>> tests - This is
// the test run data. Each tuple in the vector is a single test run. It's members are explained below.
// string test_name - This is the name of this test. It is used for reporting messages.
// TResult expected_output - This is the expected result of executing this test.
// bool(*)(const TResult expected, const TResult actual) test_compare_function - This is optional. If unset or set to nullptr it is skipped. If set to a function it is called to evaluate the test results. It takes the expected and actual results as parameters and should return true if the test passed and false otherwise. This may be changed to return a TestResults at some point.
// void(*)(TInputParams...) test_setup_function - This is optional. If unset or set to nullptr it is skipped. If set to a function it is called before each test to setup the environment for the test. You may use it to allocate resources and setup mocks, stubs, and spies.
// void(*)(TInputParams...) test_teardown_function - This is optiona. If unset or set to nullptr it is skipped. If set to a function it is called after each test to cleanup the environment after the test. You should free resources allocated by test_setup_function.
// bool is_enabled - This is optional. If unset or set to true the test is run. If set to false this test is skipped. If skipped it will be reported as a skipped/disabled test.
// bool(*)(const TResult expected, const TResult actual) suite_compare_function - This is optional. If unset or set to nullptr it is skipped. If set to a function and test_compare_function is not called for a test run then this function is called to evaluate the test results. It takes the expected and actual results as parameters and should return true if the test passed and false otherwise. This may be changed to return a TestResults at some point.
// void(*)() suite_setup_function - This is optional. If unset or set to nullptr it is skipped. If set to a function it is called before starting this test suite to setup the environment. You may use it to allocate resources and setup mocks, stubs, and spies.
// void(*)() suite_teardown_function - This is optional. If unset or set to nullptr it is skipped. If set to a function it is called after all tests in this suite have finished and all reporting has finished. You should free resources allocated by suite_setup_function.
// This method should be called like so. This is the minimal call and omits all of the optional params. This is the most common usage. You should put one tuple of inputs and expected output for each test case.
// bool(*)(const TResult expected, const TResult actual) test_compare_function - This is optional. If unset or set
// to nullptr it is skipped. If set to a function it is called to evaluate the test results. It takes the expected
// and actual results as parameters and should return true if the test passed and false otherwise. This may be
// changed to return a TestResults at some point. void(*)(TInputParams...) test_setup_function - This is optional.
// If unset or set to nullptr it is skipped. If set to a function it is called before each test to setup the
// environment for the test. You may use it to allocate resources and setup mocks, stubs, and spies.
// void(*)(TInputParams...) test_teardown_function - This is optiona. If unset or set to nullptr it is skipped. If
// set to a function it is called after each test to cleanup the environment after the test. You should free
// resources allocated by test_setup_function. bool is_enabled - This is optional. If unset or set to true the test
// is run. If set to false this test is skipped. If skipped it will be reported as a skipped/disabled test.
// bool(*)(const TResult expected, const TResult actual) suite_compare_function - This is optional. If unset or set to
// nullptr it is skipped. If set to a function and test_compare_function is not called for a test run then this
// function is called to evaluate the test results. It takes the expected and actual results as parameters and should
// return true if the test passed and false otherwise. This may be changed to return a TestResults at some point.
// void(*)() suite_setup_function - This is optional. If unset or set to nullptr it is skipped. If set to a function
// it is called before starting this test suite to setup the environment. You may use it to allocate resources and
// setup mocks, stubs, and spies. void(*)() suite_teardown_function - This is optional. If unset or set to nullptr it
// is skipped. If set to a function it is called after all tests in this suite have finished and all reporting has
// finished. You should free resources allocated by suite_setup_function.
// This method should be called like so. This is the minimal call and omits all of the optional params. This is the most
// common usage. You should put one tuple of inputs and expected output for each test case.
// results = collect_and_report_test_resultstest_fn(
// "Test: function_under_test",
// function_under_test,
@@ -248,37 +289,42 @@ namespace Test {
// ),
// }),
// );
// The suites can be run from one file as such. From a file called ThingDoer_test.cpp to test the class/methods ThingDoer declared in ThingDoer.cpp. This isn't mandatory but is a best practice.
// You can use function_to_test without calling collect_and_report_test_results() and also could call it from a normal int main(int argc, char** argv) or other function.
// The suites can be run from one file as such. From a file called ThingDoer_test.cpp to test the class/methods
// ThingDoer declared in ThingDoer.cpp. This isn't mandatory but is a best practice. You can use function_to_test
// without calling collect_and_report_test_results() and also could call it from a normal int main(int argc, char**
// argv) or other function.
// TestResults test_main_ThingDoer(int argc, char** argv) {
// TestResults results;
// results = collect_and_report_test_results(results, function_to_test("do_thing1", ...), argc, argv);
// results = collect_and_report_test_results(results, function_to_test("do_thing2", ...), argc, argv);
// return results;
// }
// Then some test harness either generated or explicit can call test_main_ThingDoer(...) and optionally reported there. Reporting granularity is controlled by how frequently you call collect_and_report_test_results(...).
// You can combine test results with results = results + function_to_test(..); and then collect_and_report_test_results on the aggregate TestResults value.
// Then some test harness either generated or explicit can call test_main_ThingDoer(...) and optionally reported there.
// Reporting granularity is controlled by how frequently you call collect_and_report_test_results(...). You can combine
// test results with results = results + function_to_test(..); and then collect_and_report_test_results on the aggregate
// TestResults value.
/// @brief
/// @tparam TResult The result type of the test.
/// @tparam TInputParams... The types of parameters sent to the test function.
/// @param suite_label The label for this test suite. For example a class name such as "MortgageCalculator".
/// @param function_to_test The function to be tested. It will be called with std::apply and a std::tuple<TInputParams...> made from each item in tests.
/// @param function_to_test The function to be tested. It will be called with std::apply and a
/// std::tuple<TInputParams...> made from each item in tests.
/// @param tests A std::vector of test runs.
/// @param suite_compare_function A function used to compare the expected and actual test results. This can be overridden per test by setting test_compare_function.
/// @param after_all This is called before each suite is started to setup the environment. This is where you should build mocks, setup spies, and test fixtures.
/// @param suite_compare_function A function used to compare the expected and actual test results. This can be
/// overridden per test by setting test_compare_function.
/// @param after_all This is called before each suite is started to setup the environment. This is where you should
/// build mocks, setup spies, and test fixtures.
/// @param before_all This is called after each suite has completed to cleanup anything allocated in suite_before_each.
/// @param is_enabled If false none of these tests are run and they are all reported as skipped.
template <typename TResult, typename... TInputParams>
TestResults execute_suite(
std::string suite_label,
TestResults execute_suite(std::string suite_label,
std::function<TResult(TInputParams...)> function_to_test,
vector<TestTuple<TResult, TInputParams...>> tests,
MaybeTestCompareFunction<TResult> suite_compare = std::nullopt,
MaybeTestConfigureFunction before_all = std::nullopt,
MaybeTestConfigureFunction after_all = std::nullopt,
bool is_enabled = true
) {
bool is_enabled = true) {
TestResults results;
std::cout << "🚀Beginning Suite: " << suite_label << std::endl;
@@ -289,20 +335,18 @@ namespace Test {
}
// Step 2: Execute Tests
for_each(tests.begin(), tests.end(), [&suite_label, &function_to_test, &results, &suite_compare](
TestTuple<TResult, TInputParams...> test_data
) {
for_each(tests.begin(),
tests.end(),
[&suite_label, &function_to_test, &results, &suite_compare](TestTuple<TResult, TInputParams...> test_data) {
// Step 2a: Extract our variables from the TestTuple.
const std::string& test_name = std::get<0>(test_data);
const std::string qualified_test_name = suite_label + "::" + test_name;
const TResult& expected_output = std::get<1>(test_data);
std::tuple<TInputParams...> input_params = std::get<2>(test_data);
MaybeTestCompareFunction<TResult> maybe_compare_function = std::get<3>(test_data);
TestCompareFunction<TResult> compare_function = maybe_compare_function.has_value()
? *maybe_compare_function
: suite_compare.has_value()
? *suite_compare
TestCompareFunction<TResult> compare_function =
maybe_compare_function.has_value() ? *maybe_compare_function
: suite_compare.has_value() ? *suite_compare
: [](const TResult& l, const TResult& r) { return l == r; };
MaybeTestConfigureFunction before_each = std::get<4>(test_data);
MaybeTestConfigureFunction after_each = std::get<5>(test_data);
@@ -372,29 +416,22 @@ namespace Test {
/// @param test_name The label for this test. For example "should calculate the interest".
/// @param expected The expected output of calling the test function with these input parameters.
/// @param input_params The input parameters to use when calling the test function.
/// @param test_compare_fn An optional function that can be used to compare the expected and actual return values. This is good for when you only care about certain fields being equal.
/// @param before_each This is called to setup the environment before running the test. This is where you should build mocks, setup spies, and set any other values you need before calling the test function.
/// @param test_compare_fn An optional function that can be used to compare the expected and actual return values. This
/// is good for when you only care about certain fields being equal.
/// @param before_each This is called to setup the environment before running the test. This is where you should build
/// mocks, setup spies, and set any other values you need before calling the test function.
/// @param after_each This is called after each test run to cleanup anything allocated in before_each.
/// @param is_enabled If false this test run is not executed and considered skipped for reporting purposes.
/// @return A TestTuple suitable for use as a test run when calling test_fn.
template <typename TResult, typename... TInputParams>
TestTuple<TResult, TInputParams...>
make_test(
const string& test_name,
TestTuple<TResult, TInputParams...> make_test(const string& test_name,
const TResult& expected,
tuple<TInputParams...> input_params,
MaybeTestCompareFunction<TResult> test_compare_fn = std::nullopt,
MaybeTestConfigureFunction before_each = std::nullopt,
MaybeTestConfigureFunction after_each = std::nullopt,
bool is_enabled = true) {
return make_tuple(
test_name,
expected,
input_params,
test_compare_fn,
before_each,
after_each,
is_enabled);
return make_tuple(test_name, expected, input_params, test_compare_fn, before_each, after_each, is_enabled);
}
/// @brief
@@ -410,8 +447,7 @@ namespace Test {
/// @param is_enabled
/// @return
template <typename TResult, typename TFunctionToTest, typename... TInputParams>
TestSuite<TResult, TInputParams...> make_test_suite(
const string& suite_name,
TestSuite<TResult, TInputParams...> make_test_suite(const string& suite_name,
TFunctionToTest function_to_test,
vector<TestTuple<TResult, TInputParams...>> test_data,
MaybeTestCompareFunction<TResult> compare = std::nullopt,
@@ -424,9 +460,7 @@ namespace Test {
template <typename TResult, typename... TInputParams>
TestResults execute_suite(const TestSuite<TResult, TInputParams...>& test_suite) {
return execute_suite<TResult, TInputParams...>(
std::get<0>(test_suite),
std::get<1>(test_suite),
std::get<2>(test_suite)
std::get<0>(test_suite), std::get<1>(test_suite), std::get<2>(test_suite)
// TODO: make this work for the optional parts of the tuple too.
);
}
@@ -437,9 +471,7 @@ namespace Test {
/// @param second
/// @return
template <typename... TInputParams>
MaybeTestConfigureFunction coalesce(
MaybeTestConfigureFunction first,
MaybeTestConfigureFunction second) {
MaybeTestConfigureFunction coalesce(MaybeTestConfigureFunction first, MaybeTestConfigureFunction second) {
if (first.has_value()) {
if (second.has_value()) {
// This is the only place we actually need to combine them.
@@ -457,10 +489,12 @@ namespace Test {
} // End namespace Test
// TODO: define operator<< for std::tuple.
// TODO: Add TShared(*)(string /*test_name*/, UUID /*test_run_id*/) allocate_shared_data to the test tuple to make some shared data that can be used in a thread safe way by setup, teardown, and evaluate steps of the test.
// TODO: Add TShared(*)(string /*test_name*/, UUID /*test_run_id*/) allocate_shared_data to the test tuple to make some
// shared data that can be used in a thread safe way by setup, teardown, and evaluate steps of the test.
// TODO: Add TShared to be returned by the setup functions, and consumed by the evaluate and teardown functions.
// Suite setup/teardown functions should allocate/free.
// Test setup/teardown functions should consume the data allocated by suite setup.
// Test setup functions may allocate additional resources. If they do then the allocated resources they should be freed by test teardown function.
// Suite and/or test compare functions may consume this shared data, but it will not be shared with the execution of function_to_test.
// Test setup functions may allocate additional resources. If they do then the allocated resources they should be
// freed by test teardown function. Suite and/or test compare functions may consume this shared data, but it will not
// be shared with the execution of function_to_test.
#endif // End !defined TEST_H__