Configures clang-format and clangd.
Runs clang-format on all c++ files.
This commit is contained in:
260
.clang-format
Normal file
260
.clang-format
Normal 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
1
.gitignore
vendored
@@ -7,3 +7,4 @@
|
|||||||
/dos/sbf/sbf_start.command
|
/dos/sbf/sbf_start.command
|
||||||
/build
|
/build
|
||||||
*.o
|
*.o
|
||||||
|
.cache
|
||||||
|
|||||||
5
Makefile
5
Makefile
@@ -63,7 +63,7 @@ MANDATORY_TARGETS = Makefile
|
|||||||
|
|
||||||
.Phony: all clean app test run_all_tests run_incremental_tests targets docs read-docs
|
.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:
|
clean:
|
||||||
rm -rf "$(BUILD_DIR)"
|
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)
|
$(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
|
$(LD) $(LDFLAGS) -o $@ $< $(APP_OBJECTS) $(TEST_OBJ) $(BUILD_DIR)/test.o
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
compile_commands.json: $(MANDATORY_TARGETS)
|
||||||
|
make clean; bear -- make
|
||||||
|
|||||||
727
compile_commands.json
Normal file
727
compile_commands.json
Normal 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"
|
||||||
|
}
|
||||||
|
]
|
||||||
@@ -1,23 +1,21 @@
|
|||||||
#include "Abilities.h"
|
#include "Abilities.h"
|
||||||
#include <string>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
namespace SBF {
|
namespace SBF {
|
||||||
using std::string;
|
|
||||||
using std::ostream;
|
using std::ostream;
|
||||||
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
ostream& operator<<(ostream& os, const AbilityType& ability) {
|
ostream& operator<<(ostream& os, const AbilityType& ability) {
|
||||||
os << "AbilityGroup: {id: " << ability.id
|
os << "AbilityGroup: {id: " << ability.id << ", singular: \"" << ability.singular << "\", plural: \""
|
||||||
<< ", singular: \"" << ability.singular
|
<< ability.plural << "\"}";
|
||||||
<< "\", plural: \"" << ability.plural << "\"}";
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator==(const AbilityType& left, const AbilityType& right) {
|
bool operator==(const AbilityType& left, const AbilityType& right) {
|
||||||
return left.id == right.id &&
|
return left.id == right.id && left.singular == right.singular && left.plural == right.plural;
|
||||||
left.singular == right.singular &&
|
|
||||||
left.plural == right.plural;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const AbilityType& left, const AbilityType& right) {
|
bool operator!=(const AbilityType& left, const AbilityType& right) {
|
||||||
|
|||||||
@@ -36,10 +36,23 @@ namespace SBF {
|
|||||||
/// @brief The plural form of this group i.e. Talents.
|
/// @brief The plural form of this group i.e. Talents.
|
||||||
std::string plural;
|
std::string plural;
|
||||||
};
|
};
|
||||||
|
|
||||||
const AbilityType kAbilityGroupUnknown = {0, "", ""};
|
const AbilityType kAbilityGroupUnknown = {0, "", ""};
|
||||||
const AbilityType kAbilityGroupTalents = {kAbilityTalentsId, kAbilityTalentsSingular, kAbilityTalentsPlural};
|
const AbilityType kAbilityGroupTalents = {
|
||||||
const AbilityType kAbilityGroupSkills = {kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural};
|
kAbilityTalentsId,
|
||||||
const AbilityType kAbilityGroupKnowledges = {kAbilityKnowledgesId, kAbilityKnowledgesSingular, kAbilityKnowledgesPlural};
|
kAbilityTalentsSingular,
|
||||||
|
kAbilityTalentsPlural,
|
||||||
|
};
|
||||||
|
const AbilityType kAbilityGroupSkills = {
|
||||||
|
kAbilitySkillsId,
|
||||||
|
kAbilitySkillsSingular,
|
||||||
|
kAbilitySkillsPlural,
|
||||||
|
};
|
||||||
|
const AbilityType kAbilityGroupKnowledges = {
|
||||||
|
kAbilityKnowledgesId,
|
||||||
|
kAbilityKnowledgesSingular,
|
||||||
|
kAbilityKnowledgesPlural,
|
||||||
|
};
|
||||||
const AbilityType kAbilities[]{
|
const AbilityType kAbilities[]{
|
||||||
kAbilityGroupUnknown,
|
kAbilityGroupUnknown,
|
||||||
kAbilityGroupTalents,
|
kAbilityGroupTalents,
|
||||||
@@ -176,12 +189,14 @@ namespace SBF {
|
|||||||
/// @param abilities The vector to fill.
|
/// @param abilities The vector to fill.
|
||||||
void FillAbilities(std::vector<AbilityType>& abilities);
|
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 abilities The vector to fill.
|
||||||
/// @param id The id of the ability group to fill for.
|
/// @param id The id of the ability group to fill for.
|
||||||
void FillAbilitiesForAbilityGroup(std::vector<std::string>& abilities, int id);
|
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 labels The vector to fill.
|
||||||
/// @param id The id of the ability group to fill for.
|
/// @param id The id of the ability group to fill for.
|
||||||
void FillAbilityLabels(std::vector<std::string>& labels, int id);
|
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.
|
/// @return The ability group with an id of id or kAbilityGroupUnknown if id is invalid.
|
||||||
const AbilityType& GetAbility(int id);
|
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 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, ...).
|
/// @param id The id for the ability within the ability group (acting, dodge, brawl, ...).
|
||||||
/// @return The label for the specific ability ("Acting").
|
/// @return The label for the specific ability ("Acting").
|
||||||
@@ -229,5 +245,6 @@ namespace SBF {
|
|||||||
/// @return The label for the specific ability.
|
/// @return The label for the specific ability.
|
||||||
const std::string GetTalentLabel(int id);
|
const std::string GetTalentLabel(int id);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined ABILITIES_H__
|
#endif // End !defined ABILITIES_H__
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#include "Abilities.h"
|
#include "Abilities.h"
|
||||||
#include "test.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "test.h"
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -23,9 +25,10 @@ namespace Test::Abilities {
|
|||||||
TestResults test_GetSkillLabel();
|
TestResults test_GetSkillLabel();
|
||||||
TestResults test_GetTalentLabel();
|
TestResults test_GetTalentLabel();
|
||||||
} // End namespace Test::Abilities
|
} // End namespace Test::Abilities
|
||||||
|
|
||||||
using 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;
|
TestResults results;
|
||||||
|
|
||||||
results += test_AbilityType_operator_extract();
|
results += test_AbilityType_operator_extract();
|
||||||
@@ -49,8 +52,7 @@ TestResults main_test_Abilities(int argc, char** argv) {
|
|||||||
|
|
||||||
namespace Test::Abilities {
|
namespace Test::Abilities {
|
||||||
TestResults test_AbilityType_operator_extract() {
|
TestResults test_AbilityType_operator_extract() {
|
||||||
return execute_suite<string, AbilityType>(
|
return execute_suite<string, AbilityType>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::AbilityType::operator<<",
|
"SBF::AbilityType::operator<<",
|
||||||
[](const AbilityType& ability) {
|
[](const AbilityType& ability) {
|
||||||
ostringstream os;
|
ostringstream os;
|
||||||
@@ -58,77 +60,61 @@ namespace Test::Abilities {
|
|||||||
return os.str();
|
return os.str();
|
||||||
},
|
},
|
||||||
vector<TestTuple<string, AbilityType>>({
|
vector<TestTuple<string, AbilityType>>({
|
||||||
make_test<string, AbilityType>(
|
make_test<string, AbilityType>("should print talents",
|
||||||
"should print talents",
|
|
||||||
"AbilityGroup: {id: 1, singular: \"Talent\", plural: \"Talents\"}",
|
"AbilityGroup: {id: 1, singular: \"Talent\", plural: \"Talents\"}",
|
||||||
make_tuple(kAbilityGroupTalents)),
|
make_tuple(kAbilityGroupTalents)),
|
||||||
make_test<string, AbilityType>(
|
make_test<string, AbilityType>("should print skills",
|
||||||
"should print skills",
|
|
||||||
"AbilityGroup: {id: 2, singular: \"Skill\", plural: \"Skills\"}",
|
"AbilityGroup: {id: 2, singular: \"Skill\", plural: \"Skills\"}",
|
||||||
make_tuple(kAbilityGroupSkills)),
|
make_tuple(kAbilityGroupSkills)),
|
||||||
make_test<string, AbilityType>(
|
make_test<string, AbilityType>("should print knowledges",
|
||||||
"should print knowledges",
|
|
||||||
"AbilityGroup: {id: 3, singular: \"Knowledge\", plural: \"Knowledges\"}",
|
"AbilityGroup: {id: 3, singular: \"Knowledge\", plural: \"Knowledges\"}",
|
||||||
make_tuple(kAbilityGroupKnowledges)),
|
make_tuple(kAbilityGroupKnowledges)),
|
||||||
make_test<string, AbilityType>(
|
make_test<string, AbilityType>("should print an unknown ability group",
|
||||||
"should print an unknown ability group",
|
|
||||||
"AbilityGroup: {id: 0, singular: \"\", plural: \"\"}",
|
"AbilityGroup: {id: 0, singular: \"\", plural: \"\"}",
|
||||||
make_tuple(kAbilityGroupUnknown)),
|
make_tuple(kAbilityGroupUnknown)),
|
||||||
})
|
})));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_AbilityType_operator_equal_to() {
|
TestResults test_AbilityType_operator_equal_to() {
|
||||||
return execute_suite<bool, AbilityType, AbilityType>(
|
return execute_suite<bool, AbilityType, AbilityType>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::AbilityType::operator==",
|
"SBF::AbilityType::operator==",
|
||||||
[](const AbilityType& left, const AbilityType& right) {
|
[](const AbilityType& left, const AbilityType& right) { return left == right; },
|
||||||
return left == right;
|
|
||||||
},
|
|
||||||
vector<TestTuple<bool, AbilityType, AbilityType>>({
|
vector<TestTuple<bool, AbilityType, AbilityType>>({
|
||||||
make_test<bool, AbilityType, AbilityType>(
|
make_test<bool, AbilityType, AbilityType>("should return true when comparing an ability group to itself",
|
||||||
"should return true when comparing an ability group to itself",
|
|
||||||
true,
|
true,
|
||||||
make_tuple(kAbilityGroupTalents, kAbilityGroupTalents)),
|
make_tuple(kAbilityGroupTalents, kAbilityGroupTalents)),
|
||||||
make_test<bool, AbilityType, AbilityType>(
|
make_test<bool, AbilityType, AbilityType>(
|
||||||
"should return true when comparing two different instances created with the same values",
|
"should return true when comparing two different instances created with the same values",
|
||||||
true,
|
true,
|
||||||
make_tuple(kAbilityGroupSkills, AbilityType({kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural}))),
|
make_tuple(kAbilityGroupSkills,
|
||||||
make_test<bool, AbilityType, AbilityType>(
|
AbilityType({kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural}))),
|
||||||
"should return false when comparing two different ability gropus",
|
make_test<bool, AbilityType, AbilityType>("should return false when comparing two different ability gropus",
|
||||||
false,
|
false,
|
||||||
make_tuple(kAbilityGroupKnowledges, kAbilityGroupSkills)),
|
make_tuple(kAbilityGroupKnowledges, kAbilityGroupSkills)),
|
||||||
})
|
})));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_AbilityType_operator_not_equal_to() {
|
TestResults test_AbilityType_operator_not_equal_to() {
|
||||||
return execute_suite<bool, AbilityType, AbilityType>(
|
return execute_suite<bool, AbilityType, AbilityType>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::AbilityType::operator!=",
|
"SBF::AbilityType::operator!=",
|
||||||
[](const AbilityType& left, const AbilityType& right) {
|
[](const AbilityType& left, const AbilityType& right) { return left != right; },
|
||||||
return left != right;
|
|
||||||
},
|
|
||||||
vector<TestTuple<bool, AbilityType, AbilityType>>({
|
vector<TestTuple<bool, AbilityType, AbilityType>>({
|
||||||
make_test<bool, AbilityType, AbilityType>(
|
make_test<bool, AbilityType, AbilityType>("should return false when comparing an ability group to itself",
|
||||||
"should return false when comparing an ability group to itself",
|
|
||||||
false,
|
false,
|
||||||
make_tuple(kAbilityGroupTalents, kAbilityGroupTalents)),
|
make_tuple(kAbilityGroupTalents, kAbilityGroupTalents)),
|
||||||
make_test<bool, AbilityType, AbilityType>(
|
make_test<bool, AbilityType, AbilityType>(
|
||||||
"should return false when comparing two different instances created with the same values",
|
"should return false when comparing two different instances created with the same values",
|
||||||
false,
|
false,
|
||||||
make_tuple(kAbilityGroupSkills, AbilityType({kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural}))),
|
make_tuple(kAbilityGroupSkills,
|
||||||
make_test<bool, AbilityType, AbilityType>(
|
AbilityType({kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural}))),
|
||||||
"should return true when comparing two different ability gropus",
|
make_test<bool, AbilityType, AbilityType>("should return true when comparing two different ability gropus",
|
||||||
true,
|
true,
|
||||||
make_tuple(kAbilityGroupKnowledges, kAbilityGroupSkills)),
|
make_tuple(kAbilityGroupKnowledges, kAbilityGroupSkills)),
|
||||||
})
|
})));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillAbilities() {
|
TestResults test_FillAbilities() {
|
||||||
return execute_suite<string>(
|
return execute_suite<string>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::FillAbilities",
|
"SBF::FillAbilities",
|
||||||
[]() -> string {
|
[]() -> string {
|
||||||
ostringstream error_message;
|
ostringstream error_message;
|
||||||
@@ -143,17 +129,12 @@ namespace Test::Abilities {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill abilities", "no errors", make_tuple()),
|
||||||
"should fill abilities",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillAbilitiesForAbilityGroup() {
|
TestResults test_FillAbilitiesForAbilityGroup() {
|
||||||
return execute_suite<vector<string>, int>(
|
return execute_suite<vector<string>, int>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::FillAbilitiesForAbilityGroup",
|
"SBF::FillAbilitiesForAbilityGroup",
|
||||||
[](int groupId) {
|
[](int groupId) {
|
||||||
vector<string> abilities = {"This should be removed."};
|
vector<string> abilities = {"This should be removed."};
|
||||||
@@ -162,32 +143,53 @@ namespace Test::Abilities {
|
|||||||
},
|
},
|
||||||
vector<TestTuple<vector<string>, int>>({
|
vector<TestTuple<vector<string>, int>>({
|
||||||
make_test<vector<string>, int>(
|
make_test<vector<string>, int>(
|
||||||
"should clear the vector for group 0, kAbilityGropuUnknownId",
|
"should clear the vector for group 0, kAbilityGropuUnknownId", {}, make_tuple(0)),
|
||||||
{},
|
make_test<vector<string>, int>("should fill talents for group 1 kAbilityGroupTalentsId",
|
||||||
make_tuple(0)),
|
{"",
|
||||||
make_test<vector<string>, int>(
|
"Acting",
|
||||||
"should fill talents for group 1 kAbilityGroupTalentsId",
|
"Alertness",
|
||||||
{"", "Acting", "Alertness", "Athletics", "Brawl", "Dodge", "Empathy", "Intimidation", "Leadership", "Streetwise", "Subterfuge"},//, "Alertness", "Athletics", "Brawl", "Dodge", "Empathy", "Intimidation", "Leadership", "Streetwise", "Subterfuge"
|
"Athletics",
|
||||||
|
"Brawl",
|
||||||
|
"Dodge",
|
||||||
|
"Empathy",
|
||||||
|
"Intimidation",
|
||||||
|
"Leadership",
|
||||||
|
"Streetwise",
|
||||||
|
"Subterfuge"}, //, "Alertness", "Athletics", "Brawl", "Dodge", "Empathy",
|
||||||
|
//"Intimidation", "Leadership", "Streetwise", "Subterfuge"
|
||||||
make_tuple(1)),
|
make_tuple(1)),
|
||||||
make_test<vector<string>, int>(
|
make_test<vector<string>, int>("should fill skills for group 2 kAbilityGroupSkillsId",
|
||||||
"should fill skills for group 2 kAbilityGroupSkillsId",
|
{"",
|
||||||
{"", "Animal Ken", "Drive", "Etiquette", "Firearms", "Melee", "Music", "Repair", "Security", "Stealth", "Survival"},
|
"Animal Ken",
|
||||||
|
"Drive",
|
||||||
|
"Etiquette",
|
||||||
|
"Firearms",
|
||||||
|
"Melee",
|
||||||
|
"Music",
|
||||||
|
"Repair",
|
||||||
|
"Security",
|
||||||
|
"Stealth",
|
||||||
|
"Survival"},
|
||||||
make_tuple(2)),
|
make_tuple(2)),
|
||||||
make_test<vector<string>, int>(
|
make_test<vector<string>, int>("should fill knowledges for group 3 kAbilityGroupKnowledgesId",
|
||||||
"should fill knowledges for group 3 kAbilityGroupKnowledgesId",
|
{"",
|
||||||
{"", "Bureaucracy", "Computer", "Finance", "Investigation", "Law", "Linguistics", "Medicine", "Occult", "Politics", "Science"},
|
"Bureaucracy",
|
||||||
|
"Computer",
|
||||||
|
"Finance",
|
||||||
|
"Investigation",
|
||||||
|
"Law",
|
||||||
|
"Linguistics",
|
||||||
|
"Medicine",
|
||||||
|
"Occult",
|
||||||
|
"Politics",
|
||||||
|
"Science"},
|
||||||
make_tuple(3)),
|
make_tuple(3)),
|
||||||
make_test<vector<string>, int>(
|
make_test<vector<string>, int>("should clear the vector for group 4 an invalid id", {}, make_tuple(4)),
|
||||||
"should clear the vector for group 4 an invalid id",
|
})));
|
||||||
{},
|
|
||||||
make_tuple(4)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillAbilityLabels() {
|
TestResults test_FillAbilityLabels() {
|
||||||
return execute_suite<vector<string>, int>(
|
return execute_suite<vector<string>, int>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::FillAbilityLabels",
|
"SBF::FillAbilityLabels",
|
||||||
[](int groupId) {
|
[](int groupId) {
|
||||||
vector<string> abilities = {"This should be removed."};
|
vector<string> abilities = {"This should be removed."};
|
||||||
@@ -196,37 +198,67 @@ namespace Test::Abilities {
|
|||||||
},
|
},
|
||||||
vector<TestTuple<vector<string>, int>>({
|
vector<TestTuple<vector<string>, int>>({
|
||||||
make_test<vector<string>, int>(
|
make_test<vector<string>, int>(
|
||||||
"should clear the vector for group 0, kAbilityGropuUnknownId",
|
"should clear the vector for group 0, kAbilityGropuUnknownId", {}, make_tuple(0)),
|
||||||
{},
|
make_test<vector<string>, int>("should fill talents for group 1 kAbilityGroupTalentsId",
|
||||||
make_tuple(0)),
|
{"",
|
||||||
make_test<vector<string>, int>(
|
"Acting",
|
||||||
"should fill talents for group 1 kAbilityGroupTalentsId",
|
"Alertness",
|
||||||
{"", "Acting", "Alertness", "Athletics", "Brawl", "Dodge", "Empathy", "Intimidation", "Leadership", "Streetwise", "Subterfuge"},
|
"Athletics",
|
||||||
|
"Brawl",
|
||||||
|
"Dodge",
|
||||||
|
"Empathy",
|
||||||
|
"Intimidation",
|
||||||
|
"Leadership",
|
||||||
|
"Streetwise",
|
||||||
|
"Subterfuge"},
|
||||||
make_tuple(1)),
|
make_tuple(1)),
|
||||||
make_test<vector<string>, int>(
|
make_test<vector<string>, int>("should fill skills for group 2 kAbilityGroupSkillsId",
|
||||||
"should fill skills for group 2 kAbilityGroupSkillsId",
|
{"",
|
||||||
{"", "Animal Ken", "Drive", "Etiquette", "Firearms", "Melee", "Music", "Repair", "Security", "Stealth", "Survival"},
|
"Animal Ken",
|
||||||
|
"Drive",
|
||||||
|
"Etiquette",
|
||||||
|
"Firearms",
|
||||||
|
"Melee",
|
||||||
|
"Music",
|
||||||
|
"Repair",
|
||||||
|
"Security",
|
||||||
|
"Stealth",
|
||||||
|
"Survival"},
|
||||||
make_tuple(2)),
|
make_tuple(2)),
|
||||||
make_test<vector<string>, int>(
|
make_test<vector<string>, int>("should fill knowledges for group 3 kAbilityGroupKnowledgesId",
|
||||||
"should fill knowledges for group 3 kAbilityGroupKnowledgesId",
|
{"",
|
||||||
{"", "Bureaucracy", "Computer", "Finance", "Investigation", "Law", "Linguistics", "Medicine", "Occult", "Politics", "Science"},
|
"Bureaucracy",
|
||||||
|
"Computer",
|
||||||
|
"Finance",
|
||||||
|
"Investigation",
|
||||||
|
"Law",
|
||||||
|
"Linguistics",
|
||||||
|
"Medicine",
|
||||||
|
"Occult",
|
||||||
|
"Politics",
|
||||||
|
"Science"},
|
||||||
make_tuple(3)),
|
make_tuple(3)),
|
||||||
make_test<vector<string>, int>(
|
make_test<vector<string>, int>("should clear the vector for group 4 an invalid id", {}, make_tuple(4)),
|
||||||
"should clear the vector for group 4 an invalid id",
|
})));
|
||||||
{},
|
|
||||||
make_tuple(4)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillKnowledgeLabels() {
|
TestResults test_FillKnowledgeLabels() {
|
||||||
return execute_suite<string>(
|
return execute_suite<string>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::FillKnowlegeLabels",
|
"SBF::FillKnowlegeLabels",
|
||||||
[]() -> string {
|
[]() -> string {
|
||||||
ostringstream error_message;
|
ostringstream error_message;
|
||||||
vector<string> actual = {"This should be removed."};
|
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);
|
FillKnowledgeLabels(actual);
|
||||||
compare(error_message, expected, actual);
|
compare(error_message, expected, actual);
|
||||||
string error = error_message.str();
|
string error = error_message.str();
|
||||||
@@ -236,22 +268,27 @@ namespace Test::Abilities {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill knowledge labels", "no errors", make_tuple()),
|
||||||
"should fill knowledge labels",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillSkillLabels() {
|
TestResults test_FillSkillLabels() {
|
||||||
return execute_suite<string>(
|
return execute_suite<string>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::FillSkillLabels",
|
"SBF::FillSkillLabels",
|
||||||
[]() -> string {
|
[]() -> string {
|
||||||
ostringstream error_message;
|
ostringstream error_message;
|
||||||
vector<string> actual = {"This should be removed."};
|
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);
|
FillSkillLabels(actual);
|
||||||
compare(error_message, expected, actual);
|
compare(error_message, expected, actual);
|
||||||
string error = error_message.str();
|
string error = error_message.str();
|
||||||
@@ -261,22 +298,27 @@ namespace Test::Abilities {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill skill labels", "no errors", make_tuple()),
|
||||||
"should fill skill labels",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillTalentLabels() {
|
TestResults test_FillTalentLabels() {
|
||||||
return execute_suite<string>(
|
return execute_suite<string>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::FillTalentLabels",
|
"SBF::FillTalentLabels",
|
||||||
[]() -> string {
|
[]() -> string {
|
||||||
ostringstream error_message;
|
ostringstream error_message;
|
||||||
vector<string> actual = {"This should be removed."};
|
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);
|
FillTalentLabels(actual);
|
||||||
compare(error_message, expected, actual);
|
compare(error_message, expected, actual);
|
||||||
string error = error_message.str();
|
string error = error_message.str();
|
||||||
@@ -286,394 +328,137 @@ namespace Test::Abilities {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill knowledge labels", "no errors", make_tuple()),
|
||||||
"should fill knowledge labels",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_GetAbility() {
|
TestResults test_GetAbility() {
|
||||||
return execute_suite<AbilityType, int>(
|
return execute_suite<AbilityType, int>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::GetAbility",
|
"SBF::GetAbility",
|
||||||
GetAbility,
|
GetAbility,
|
||||||
vector<TestTuple<AbilityType, int>>({
|
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>(
|
make_test<AbilityType, int>(
|
||||||
"should get talents",
|
"should get knowledges", kAbilityGroupKnowledges, make_tuple(kAbilityKnowledgesId)),
|
||||||
kAbilityGroupTalents,
|
make_test<AbilityType, int>("should get unknown for id 0", kAbilityGroupUnknown, make_tuple(0)),
|
||||||
make_tuple(kAbilityTalentsId)),
|
make_test<AbilityType, int>("should get unknown for an invalid id", kAbilityGroupUnknown, make_tuple(4)),
|
||||||
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)),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_GetAbilityLabel() {
|
TestResults test_GetAbilityLabel() {
|
||||||
return execute_suite<string, int, int>(
|
return execute_suite<string, int, int>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::GetAbilityLabel",
|
"SBF::GetAbilityLabel",
|
||||||
GetAbilityLabel,
|
GetAbilityLabel,
|
||||||
vector<TestTuple<string, int, int>>({
|
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>(
|
make_test<string, int, int>(
|
||||||
"should get Acting for group 1 and id 1",
|
"should get Investigation for group 3 and id 4", "Investigation", make_tuple(3, 4)),
|
||||||
"Acting",
|
make_test<string, int, int>("should get Law for group 3 and id 5", "Law", make_tuple(3, 5)),
|
||||||
make_tuple(1, 1)),
|
make_test<string, int, int>("should get Linguistics for group 3 and id 6", "Linguistics", make_tuple(3, 6)),
|
||||||
make_test<string, int, int>(
|
make_test<string, int, int>("should get Medicine for group 3 and id 7", "Medicine", make_tuple(3, 7)),
|
||||||
"should get Alertness for group 1 and id 2",
|
make_test<string, int, int>("should get Occult for group 3 and id 8", "Occult", make_tuple(3, 8)),
|
||||||
"Alertness",
|
make_test<string, int, int>("should get Politics for group 3 and id 9", "Politics", make_tuple(3, 9)),
|
||||||
make_tuple(1, 2)),
|
make_test<string, int, int>("should get Science for group 3 and id 10", "Science", make_tuple(3, 10)),
|
||||||
make_test<string, int, int>(
|
make_test<string, int, int>("should get and empty string for group 0 and id 0", "", make_tuple(0, 0)),
|
||||||
"should get Athletics for group 1 and id 3",
|
make_test<string, int, int>("should get and empty string for group 1 and id 11", "", make_tuple(1, 11)),
|
||||||
"Athletics",
|
make_test<string, int, int>("should get and empty string for group 4 and id 1", "", make_tuple(4, 1)),
|
||||||
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)),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_GetKnowledgeLabel() {
|
TestResults test_GetKnowledgeLabel() {
|
||||||
return execute_suite<string, int>(
|
return execute_suite<string, int>(
|
||||||
make_test_suite(
|
make_test_suite("SBF::GetKnowledgeLabel",
|
||||||
"SBF::GetKnowledgeLabel",
|
|
||||||
GetKnowledgeLabel,
|
GetKnowledgeLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get Bureaucracy for id 1", "Bureaucracy", make_tuple(1)),
|
||||||
"should get Bureaucracy for id 1",
|
make_test<string, int>("should get Computer for id 2", "Computer", make_tuple(2)),
|
||||||
"Bureaucracy",
|
make_test<string, int>("should get Finance for id 3", "Finance", make_tuple(3)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get Investigation for id 4", "Investigation", make_tuple(4)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get Law for id 5", "Law", make_tuple(5)),
|
||||||
"should get Computer for id 2",
|
make_test<string, int>("should get Linguistics for id 6", "Linguistics", make_tuple(6)),
|
||||||
"Computer",
|
make_test<string, int>("should get Medicine for id 7", "Medicine", make_tuple(7)),
|
||||||
make_tuple(2)),
|
make_test<string, int>("should get Occult for id 8", "Occult", make_tuple(8)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get Politics for id 9", "Politics", make_tuple(9)),
|
||||||
"should get Finance for id 3",
|
make_test<string, int>("should get Science for id 10", "Science", make_tuple(10)),
|
||||||
"Finance",
|
make_test<string, int>("should get and empty string for id 0", "", make_tuple(0)),
|
||||||
make_tuple(3)),
|
make_test<string, int>("should get and empty string for id 11", "", make_tuple(11)),
|
||||||
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();
|
return TestResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_GetNumItemsForAbilityGroup() {
|
TestResults test_GetNumItemsForAbilityGroup() {
|
||||||
return execute_suite<int, int>(
|
return execute_suite<int, int>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::GetNumItemsForAbilityGroup",
|
"SBF::GetNumItemsForAbilityGroup",
|
||||||
GetNumItemsForAbilityGroup,
|
GetNumItemsForAbilityGroup,
|
||||||
vector<TestTuple<int, int>>({
|
vector<TestTuple<int, int>>({
|
||||||
make_test<int, int>(
|
make_test<int, int>("should get 10 abilities for talents", 10, make_tuple(kAbilityTalentsId)),
|
||||||
"should get 10 abilities for talents",
|
make_test<int, int>("should get 10 abilities for skills", 10, make_tuple(kAbilitySkillsId)),
|
||||||
10,
|
make_test<int, int>("should get 10 abilities for knowledges", 10, make_tuple(kAbilityKnowledgesId)),
|
||||||
make_tuple(kAbilityTalentsId)),
|
make_test<int, int>("should get 0 abilities for 0", 0, make_tuple(0)),
|
||||||
make_test<int, int>(
|
make_test<int, int>("should get 0 abilities for an invalid id", 0, make_tuple(4)),
|
||||||
"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() {
|
TestResults test_GetSkillLabel() {
|
||||||
return execute_suite<string, int>(
|
return execute_suite<string, int>(
|
||||||
make_test_suite(
|
make_test_suite("SBF::GetSkillLabel",
|
||||||
"SBF::GetSkillLabel",
|
|
||||||
GetSkillLabel,
|
GetSkillLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get Animal Ken for id 1", "Animal Ken", make_tuple(1)),
|
||||||
"should get Animal Ken for id 1",
|
make_test<string, int>("should get Drive for id 2", "Drive", make_tuple(2)),
|
||||||
"Animal Ken",
|
make_test<string, int>("should get Etiquette for id 3", "Etiquette", make_tuple(3)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get Firearms for id 4", "Firearms", make_tuple(4)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get Melee for id 5", "Melee", make_tuple(5)),
|
||||||
"should get Drive for id 2",
|
make_test<string, int>("should get Music for id 6", "Music", make_tuple(6)),
|
||||||
"Drive",
|
make_test<string, int>("should get Repair for id 7", "Repair", make_tuple(7)),
|
||||||
make_tuple(2)),
|
make_test<string, int>("should get Security for id 8", "Security", make_tuple(8)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get Stealth for id 9", "Stealth", make_tuple(9)),
|
||||||
"should get Etiquette for id 3",
|
make_test<string, int>("should get Survival for id 10", "Survival", make_tuple(10)),
|
||||||
"Etiquette",
|
make_test<string, int>("should get and empty string for id 0", "", make_tuple(0)),
|
||||||
make_tuple(3)),
|
make_test<string, int>("should get and empty string for id 11", "", make_tuple(11)),
|
||||||
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() {
|
TestResults test_GetTalentLabel() {
|
||||||
return execute_suite<string, int>(
|
return execute_suite<string, int>(
|
||||||
make_test_suite(
|
make_test_suite("SBF::GetTalentLabel",
|
||||||
"SBF::GetTalentLabel",
|
|
||||||
GetTalentLabel,
|
GetTalentLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get Acting for id 1", "Acting", make_tuple(1)),
|
||||||
"should get Acting for id 1",
|
make_test<string, int>("should get Alertness for id 2", "Alertness", make_tuple(2)),
|
||||||
"Acting",
|
make_test<string, int>("should get Athletics for id 3", "Athletics", make_tuple(3)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get Brawl for id 4", "Brawl", make_tuple(4)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get Dodge for id 5", "Dodge", make_tuple(5)),
|
||||||
"should get Alertness for id 2",
|
make_test<string, int>("should get Empathy for id 6", "Empathy", make_tuple(6)),
|
||||||
"Alertness",
|
make_test<string, int>("should get Intimidation for id 7", "Intimidation", make_tuple(7)),
|
||||||
make_tuple(2)),
|
make_test<string, int>("should get Leadership for id 8", "Leadership", make_tuple(8)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get Streetwise for id 9", "Streetwise", make_tuple(9)),
|
||||||
"should get Athletics for id 3",
|
make_test<string, int>("should get Subterfuge for id 10", "Subterfuge", make_tuple(10)),
|
||||||
"Athletics",
|
make_test<string, int>("should get and empty string for id 0", "", make_tuple(0)),
|
||||||
make_tuple(3)),
|
make_test<string, int>("should get and empty string for id 11", "", make_tuple(11)),
|
||||||
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
|
} // End namespace Test::Abilities
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "Archetypes.h"
|
#include "Archetypes.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -17,4 +18,3 @@ namespace SBF {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
|
|||||||
@@ -119,5 +119,6 @@ namespace SBF {
|
|||||||
/// @param archetypeLabels The vector to fill.
|
/// @param archetypeLabels The vector to fill.
|
||||||
void FillArchetypeLabels(std::vector<std::string>& archetypeLabels);
|
void FillArchetypeLabels(std::vector<std::string>& archetypeLabels);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined ARCHETYPES_H__
|
#endif // End !defined ARCHETYPES_H__
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
#include "Archetypes.h"
|
#include "Archetypes.h"
|
||||||
#include "test.h"
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "test.h"
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -10,6 +12,7 @@ namespace Test::Archetypes {
|
|||||||
TestResults test_GetArchetypeLabel();
|
TestResults test_GetArchetypeLabel();
|
||||||
TestResults test_FillArchetypeLabels();
|
TestResults test_FillArchetypeLabels();
|
||||||
} // End namespace Test::Archetypes
|
} // End namespace Test::Archetypes
|
||||||
|
|
||||||
using namespace Test::Archetypes;
|
using namespace Test::Archetypes;
|
||||||
|
|
||||||
TestResults main_test_Archetypes(int argc, char** argv) {
|
TestResults main_test_Archetypes(int argc, char** argv) {
|
||||||
@@ -27,136 +30,39 @@ namespace Test::Archetypes {
|
|||||||
"SBF::GetArchetypeLabel",
|
"SBF::GetArchetypeLabel",
|
||||||
GetArchetypeLabel,
|
GetArchetypeLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should return \"\" for id 0", "", make_tuple(0)),
|
||||||
"should return \"\" for id 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_tuple(0)),
|
make_test<string, int>("should return \"Barbarian\" for id 3", "Barbarian", make_tuple(3)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should return \"Bon Vivant\" for id 4", "Bon Vivant", make_tuple(4)),
|
||||||
"should return \"Architect\" for id 1",
|
make_test<string, int>("should return \"Bravo\" for id 5", "Bravo", make_tuple(5)),
|
||||||
"Architect",
|
make_test<string, int>("should return \"Caregiver\" for id 6", "Caregiver", make_tuple(6)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should return \"Caretaker\" for id 7", "Caretaker", make_tuple(7)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should return \"Celebrant\" for id 8", "Celebrant", make_tuple(8)),
|
||||||
"should return \"Autocrat\" for id 2",
|
make_test<string, int>("should return \"Child\" for id 9", "Child", make_tuple(9)),
|
||||||
"Autocrat",
|
make_test<string, int>("should return \"Conformist\" for id 10", "Conformist", make_tuple(10)),
|
||||||
make_tuple(2)),
|
make_test<string, int>("should return \"Conniver\" for id 11", "Conniver", make_tuple(11)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should return \"Curmudgeon\" for id 12", "Curmudgeon", make_tuple(12)),
|
||||||
"should return \"Barbarian\" for id 3",
|
make_test<string, int>("should return \"Defender\" for id 13", "Defender", make_tuple(13)),
|
||||||
"Barbarian",
|
make_test<string, int>("should return \"Deviant\" for id 14", "Deviant", make_tuple(14)),
|
||||||
make_tuple(3)),
|
make_test<string, int>("should return \"Director\" for id 15", "Director", make_tuple(15)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should return \"Fanatic\" for id 16", "Fanatic", make_tuple(16)),
|
||||||
"should return \"Bon Vivant\" for id 4",
|
make_test<string, int>("should return \"Gallant\" for id 17", "Gallant", make_tuple(17)),
|
||||||
"Bon Vivant",
|
make_test<string, int>("should return \"Innovator\" for id 18", "Innovator", make_tuple(18)),
|
||||||
make_tuple(4)),
|
make_test<string, int>("should return \"Jester\" for id 19", "Jester", make_tuple(19)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should return \"Judge\" for id 20", "Judge", make_tuple(20)),
|
||||||
"should return \"Bravo\" for id 5",
|
make_test<string, int>("should return \"Loaner\" for id 21", "Loaner", make_tuple(21)),
|
||||||
"Bravo",
|
make_test<string, int>("should return \"Martyr\" for id 22", "Martyr", make_tuple(22)),
|
||||||
make_tuple(5)),
|
make_test<string, int>("should return \"Monster\" for id 23", "Monster", make_tuple(23)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should return \"Penitent\" for id 24", "Penitent", make_tuple(24)),
|
||||||
"should return \"Caregiver\" for id 6",
|
make_test<string, int>("should return \"Rebel\" for id 25", "Rebel", make_tuple(25)),
|
||||||
"Caregiver",
|
make_test<string, int>("should return \"Rogue\" for id 26", "Rogue", make_tuple(26)),
|
||||||
make_tuple(6)),
|
make_test<string, int>("should return \"Survivor\" for id 27", "Survivor", make_tuple(27)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should return \"Traditionalist\" for id 28", "Traditionalist", make_tuple(28)),
|
||||||
"should return \"Caretaker\" for id 7",
|
make_test<string, int>("should return \"Tyrant\" for id 29", "Tyrant", make_tuple(29)),
|
||||||
"Caretaker",
|
make_test<string, int>("should return \"Visionary\" for id 30", "Visionary", make_tuple(30)),
|
||||||
make_tuple(7)),
|
make_test<string, int>("should return \"\" for an invalid id", "", make_tuple(31)),
|
||||||
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() {
|
TestResults test_FillArchetypeLabels() {
|
||||||
@@ -164,7 +70,11 @@ namespace Test::Archetypes {
|
|||||||
"SBF::FillArchetypeLabels",
|
"SBF::FillArchetypeLabels",
|
||||||
[]() -> string {
|
[]() -> string {
|
||||||
ostringstream error_message;
|
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."};
|
vector<string> actual = {"This should be removed."};
|
||||||
FillArchetypeLabels(actual);
|
FillArchetypeLabels(actual);
|
||||||
compare(error_message, expected, actual);
|
compare(error_message, expected, actual);
|
||||||
@@ -175,11 +85,7 @@ namespace Test::Archetypes {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill archetype labels", "no errors", make_tuple()),
|
||||||
"should fill archetype labels",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
} // End namespace Test::Archetypes
|
} // End namespace Test::Archetypes
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#include "Attributes.h"
|
#include "Attributes.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
namespace SBF {
|
namespace SBF {
|
||||||
using std::string;
|
using std::string;
|
||||||
@@ -137,4 +138,3 @@ void FillMentalAttributeLabels(std::vector<std::string>& labels) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
|
|||||||
@@ -171,5 +171,6 @@ namespace SBF {
|
|||||||
/// @param labels The vector to fill. It will be cleared first.
|
/// @param labels The vector to fill. It will be cleared first.
|
||||||
void FillMentalAttributeLabels(std::vector<std::string>& labels);
|
void FillMentalAttributeLabels(std::vector<std::string>& labels);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined ATTRIBUTES_H__
|
#endif // End !defined ATTRIBUTES_H__
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "Attributes.h"
|
#include "Attributes.h"
|
||||||
#include "test.h"
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <tuple>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
@@ -26,6 +28,7 @@ TestResults test_FillPhysicalAttributeLabels();
|
|||||||
TestResults test_FillSocialAttributeLabels();
|
TestResults test_FillSocialAttributeLabels();
|
||||||
TestResults test_FillMentalAttributeLabels();
|
TestResults test_FillMentalAttributeLabels();
|
||||||
} // End namespace Test::Attributes
|
} // End namespace Test::Attributes
|
||||||
|
|
||||||
using namespace Test::Attributes;
|
using namespace Test::Attributes;
|
||||||
|
|
||||||
TestResults main_test_Attributes(int argc, char** argv) {
|
TestResults main_test_Attributes(int argc, char** argv) {
|
||||||
@@ -52,32 +55,16 @@ TestResults main_test_Attributes(int argc, char** argv) {
|
|||||||
|
|
||||||
namespace Test::Attributes {
|
namespace Test::Attributes {
|
||||||
TestResults test_GetAttributeGroupLabel() {
|
TestResults test_GetAttributeGroupLabel() {
|
||||||
return execute_suite<string, int>(make_test_suite(
|
return execute_suite<string, int>(
|
||||||
"SBF::GetAttributeGroupLabel",
|
make_test_suite("SBF::GetAttributeGroupLabel",
|
||||||
GetAttributeGroupLabel,
|
GetAttributeGroupLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for id 0", "", make_tuple(0)),
|
||||||
"should get \"\" for id 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_tuple(0)),
|
make_test<string, int>("should get \"Mental\" for id 3", "Mental", make_tuple(3)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for id 4", "", make_tuple(4)),
|
||||||
"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() {
|
TestResults test_GetAttributeLabel() {
|
||||||
@@ -85,60 +72,25 @@ TestResults test_GetAttributeLabel() {
|
|||||||
"SBF::GetAttributeLabel",
|
"SBF::GetAttributeLabel",
|
||||||
GetAttributeLabel,
|
GetAttributeLabel,
|
||||||
vector<TestTuple<string, int, int>>({
|
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>(
|
make_test<string, int, int>(
|
||||||
"should get \"Strength\" for group id 1 and id 1",
|
"should get \"Dexterity\" for group id 1 and id 2", "Dexterity", make_tuple(1, 2)),
|
||||||
"Strength",
|
make_test<string, int, int>("should get \"Stamina\" for group id 1 and id 3", "Stamina", make_tuple(1, 3)),
|
||||||
make_tuple(1, 1)),
|
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>(
|
make_test<string, int, int>(
|
||||||
"should get \"Dexterity\" for group id 1 and id 2",
|
"should get \"Manipulation\" for group id 2 and id 2", "Manipulation", make_tuple(2, 2)),
|
||||||
"Dexterity",
|
|
||||||
make_tuple(1, 2)),
|
|
||||||
make_test<string, int, int>(
|
make_test<string, int, int>(
|
||||||
"should get \"Stamina\" for group id 1 and id 3",
|
"should get \"Appearance\" for group id 2 and id 3", "Appearance", make_tuple(2, 3)),
|
||||||
"Stamina",
|
|
||||||
make_tuple(1, 3)),
|
|
||||||
make_test<string, int, int>(
|
make_test<string, int, int>(
|
||||||
"should get \"Charisma\" for group id 2 and id 1",
|
"should get \"Intelligence\" for group id 3 and id 1", "Intelligence", make_tuple(3, 1)),
|
||||||
"Charisma",
|
|
||||||
make_tuple(2, 1)),
|
|
||||||
make_test<string, int, int>(
|
make_test<string, int, int>(
|
||||||
"should get \"Manipulation\" for group id 2 and id 2",
|
"should get \"Perception\" for group id 3 and id 2", "Perception", make_tuple(3, 2)),
|
||||||
"Manipulation",
|
make_test<string, int, int>("should get \"Wits\" for group id 3 and id 3", "Wits", make_tuple(3, 3)),
|
||||||
make_tuple(2, 2)),
|
make_test<string, int, int>("should get \"\" for an invalid group id 0", "", make_tuple(0, 1)),
|
||||||
make_test<string, int, int>(
|
make_test<string, int, int>("should get \"\" for an invalid id 0", "", make_tuple(1, 0)),
|
||||||
"should get \"Appearance\" for group id 2 and id 3",
|
make_test<string, int, int>("should get \"\" for invalid group id 4", "", make_tuple(4, 1)),
|
||||||
"Appearance",
|
make_test<string, int, int>("should get \"\" for an invalid id 4", "", make_tuple(1, 4)),
|
||||||
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)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_GetAttributeLabelAbbreviation() {
|
TestResults test_GetAttributeLabelAbbreviation() {
|
||||||
@@ -146,263 +98,111 @@ TestResults test_GetAttributeLabelAbbreviation() {
|
|||||||
"SBF::GetAttributeLabelAbbreviation",
|
"SBF::GetAttributeLabelAbbreviation",
|
||||||
GetAttributeLabelAbbreviation,
|
GetAttributeLabelAbbreviation,
|
||||||
vector<TestTuple<string, int, int>>({
|
vector<TestTuple<string, int, int>>({
|
||||||
make_test<string, int, int>(
|
make_test<string, int, int>("should get \"Str.\" for group id 1 and id 1", "Str.", make_tuple(1, 1)),
|
||||||
"should get \"Str.\" for group id 1 and id 1",
|
make_test<string, int, int>("should get \"Dex.\" for group id 1 and id 2", "Dex.", make_tuple(1, 2)),
|
||||||
"Str.",
|
make_test<string, int, int>("should get \"Sta.\" for group id 1 and id 3", "Sta.", make_tuple(1, 3)),
|
||||||
make_tuple(1, 1)),
|
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>(
|
make_test<string, int, int>("should get \"Man.\" for group id 2 and id 2", "Man.", make_tuple(2, 2)),
|
||||||
"should get \"Dex.\" for group id 1 and id 2",
|
make_test<string, int, int>("should get \"App.\" for group id 2 and id 3", "App.", make_tuple(2, 3)),
|
||||||
"Dex.",
|
make_test<string, int, int>("should get \"Int.\" for group id 3 and id 1", "Int.", make_tuple(3, 1)),
|
||||||
make_tuple(1, 2)),
|
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>(
|
make_test<string, int, int>("should get \"Wits\" for group id 3 and id 3", "Wits", make_tuple(3, 3)),
|
||||||
"should get \"Sta.\" for group id 1 and id 3",
|
make_test<string, int, int>("should get \"\" for an invalid group id 0", "", make_tuple(0, 1)),
|
||||||
"Sta.",
|
make_test<string, int, int>("should get \"\" for an invalid id 0", "", make_tuple(1, 0)),
|
||||||
make_tuple(1, 3)),
|
make_test<string, int, int>("should get \"\" for invalid group id 4", "", make_tuple(4, 1)),
|
||||||
make_test<string, int, int>(
|
make_test<string, int, int>("should get \"\" for an invalid id 4", "", make_tuple(1, 4)),
|
||||||
"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() {
|
TestResults test_GetPhysicalAttributeLabel() {
|
||||||
return execute_suite<string, int>(make_test_suite(
|
return execute_suite<string, int>(
|
||||||
"SBF::GetPhysicalAttributeLabel",
|
make_test_suite("SBF::GetPhysicalAttributeLabel",
|
||||||
GetPhysicalAttributeLabel,
|
GetPhysicalAttributeLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Strength\" for id 1", "Strength", make_tuple(1)),
|
||||||
"should get \"Strength\" for id 1",
|
make_test<string, int>("should get \"Dexterity\" for id 2", "Dexterity", make_tuple(2)),
|
||||||
"Strength",
|
make_test<string, int>("should get \"Stamina\" for id 3", "Stamina", make_tuple(3)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
|
||||||
"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() {
|
TestResults test_GetPhysicalAttributeLabelAbbreviation() {
|
||||||
return execute_suite<string, int>(make_test_suite(
|
return execute_suite<string, int>(
|
||||||
"SBF::GetPhysicalAttributeLabelAbbreviation",
|
make_test_suite("SBF::GetPhysicalAttributeLabelAbbreviation",
|
||||||
GetPhysicalAttributeLabelAbbreviation,
|
GetPhysicalAttributeLabelAbbreviation,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Str.\" for id 1", "Str.", make_tuple(1)),
|
||||||
"should get \"Str.\" for id 1",
|
make_test<string, int>("should get \"Dex.\" for id 2", "Dex.", make_tuple(2)),
|
||||||
"Str.",
|
make_test<string, int>("should get \"Sta.\" for id 3", "Sta.", make_tuple(3)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
|
||||||
"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() {
|
TestResults test_GetSocialAttributeLabel() {
|
||||||
return execute_suite<string, int>(make_test_suite(
|
return execute_suite<string, int>(
|
||||||
"SBF::GetSocialAttributeLabel",
|
make_test_suite("SBF::GetSocialAttributeLabel",
|
||||||
GetSocialAttributeLabel,
|
GetSocialAttributeLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Charisma\" for id 1", "Charisma", make_tuple(1)),
|
||||||
"should get \"Charisma\" for id 1",
|
make_test<string, int>("should get \"Manipulation\" for id 2", "Manipulation", make_tuple(2)),
|
||||||
"Charisma",
|
make_test<string, int>("should get \"Appearance\" for id 3", "Appearance", make_tuple(3)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
|
||||||
"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() {
|
TestResults test_GetSocialAttributeLabelAbbreviation() {
|
||||||
return execute_suite<string, int>(make_test_suite(
|
return execute_suite<string, int>(
|
||||||
"SBF::GetSocialAttributeLabelAbbreviation",
|
make_test_suite("SBF::GetSocialAttributeLabelAbbreviation",
|
||||||
GetSocialAttributeLabelAbbreviation,
|
GetSocialAttributeLabelAbbreviation,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Cha.\" for id 1", "Cha.", make_tuple(1)),
|
||||||
"should get \"Cha.\" for id 1",
|
make_test<string, int>("should get \"Man.\" for id 2", "Man.", make_tuple(2)),
|
||||||
"Cha.",
|
make_test<string, int>("should get \"App.\" for id 3", "App.", make_tuple(3)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
|
||||||
"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() {
|
TestResults test_GetMentalAttributeLabel() {
|
||||||
return execute_suite<string, int>(make_test_suite(
|
return execute_suite<string, int>(
|
||||||
"SBF::GetMentalAttributeLabel",
|
make_test_suite("SBF::GetMentalAttributeLabel",
|
||||||
GetMentalAttributeLabel,
|
GetMentalAttributeLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Intelligence\" for id 1", "Intelligence", make_tuple(1)),
|
||||||
"should get \"Intelligence\" for id 1",
|
make_test<string, int>("should get \"Perception\" for id 2", "Perception", make_tuple(2)),
|
||||||
"Intelligence",
|
make_test<string, int>("should get \"Wits\" for id 3", "Wits", make_tuple(3)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
|
||||||
"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() {
|
TestResults test_GetMentalAttributeLabelAbbreviation() {
|
||||||
return execute_suite<string, int>(make_test_suite(
|
return execute_suite<string, int>(
|
||||||
"SBF::GetMentalAttributeLabelAbbreviation",
|
make_test_suite("SBF::GetMentalAttributeLabelAbbreviation",
|
||||||
GetMentalAttributeLabelAbbreviation,
|
GetMentalAttributeLabelAbbreviation,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Int.\" for id 1", "Int.", make_tuple(1)),
|
||||||
"should get \"Int.\" for id 1",
|
make_test<string, int>("should get \"Per.\" for id 2", "Per.", make_tuple(2)),
|
||||||
"Int.",
|
make_test<string, int>("should get \"Wits\" for id 3", "Wits", make_tuple(3)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get \"\" for invalid id 0", "", make_tuple(0)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for invalid id 4", "", make_tuple(4)),
|
||||||
"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() {
|
TestResults test_GetNumAttributesInGroup() {
|
||||||
return execute_suite<int, int>(make_test_suite(
|
return execute_suite<int, int>(
|
||||||
"SBF::GetNumAttributesInGroup",
|
make_test_suite("SBF::GetNumAttributesInGroup",
|
||||||
GetNumAttributesInGroup,
|
GetNumAttributesInGroup,
|
||||||
vector<TestTuple<int, int>>({
|
vector<TestTuple<int, int>>({
|
||||||
make_test<int, int>(
|
make_test<int, int>("should get 0 for invalid group 0", 0, make_tuple(0)),
|
||||||
"should get 0 for invalid group 0",
|
make_test<int, int>("should get 3 for group 1 kAttributeGroupPhysicalId", 3, make_tuple(1)),
|
||||||
0,
|
make_test<int, int>("should get 3 for group 2 kAttributeGropuSocialId", 3, make_tuple(2)),
|
||||||
make_tuple(0)),
|
make_test<int, int>("should get 3 for group 3 kAttributeGroupMentalId", 3, make_tuple(3)),
|
||||||
make_test<int, int>(
|
make_test<int, int>("should get 0 for invalid group 4", 0, make_tuple(4)),
|
||||||
"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() {
|
TestResults test_FillAttributeGroupLabels() {
|
||||||
@@ -421,13 +221,10 @@ TestResults test_FillAttributeGroupLabels() {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill attribute group labels", "no errors", make_tuple()),
|
||||||
"should fill attribute group labels",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void FillAttributeLabelInGroup(std::vector<std::string> attributeLabels);
|
// void FillAttributeLabelInGroup(std::vector<std::string> attributeLabels);
|
||||||
TestResults test_FillAttributeLabelsInGroup() {
|
TestResults test_FillAttributeLabelsInGroup() {
|
||||||
return execute_suite<string, int, vector<string>>(make_test_suite(
|
return execute_suite<string, int, vector<string>>(make_test_suite(
|
||||||
@@ -445,9 +242,7 @@ TestResults test_FillAttributeLabelsInGroup() {
|
|||||||
},
|
},
|
||||||
vector<TestTuple<string, int, vector<string>>>({
|
vector<TestTuple<string, int, vector<string>>>({
|
||||||
make_test<string, int, vector<string>>(
|
make_test<string, int, vector<string>>(
|
||||||
"should fill an empty list for invalid group 0",
|
"should fill an empty list for invalid group 0", "no errors", make_tuple(0, vector<string>({}))),
|
||||||
"no errors",
|
|
||||||
make_tuple(0, vector<string>({}))),
|
|
||||||
make_test<string, int, vector<string>>(
|
make_test<string, int, vector<string>>(
|
||||||
"should fill physical attribute labels for group 1 kAttributeGropuPhysicalId",
|
"should fill physical attribute labels for group 1 kAttributeGropuPhysicalId",
|
||||||
"no errors",
|
"no errors",
|
||||||
@@ -461,11 +256,8 @@ TestResults test_FillAttributeLabelsInGroup() {
|
|||||||
"no errors",
|
"no errors",
|
||||||
make_tuple(3, vector<string>({"Intelligence", "Perception", "Wits"}))),
|
make_tuple(3, vector<string>({"Intelligence", "Perception", "Wits"}))),
|
||||||
make_test<string, int, vector<string>>(
|
make_test<string, int, vector<string>>(
|
||||||
"should fill an empty list for invalid group 4",
|
"should fill an empty list for invalid group 4", "no errors", make_tuple(4, vector<string>({}))),
|
||||||
"no errors",
|
})));
|
||||||
make_tuple(4, vector<string>({}))),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillPhysicalAttributeLabels() {
|
TestResults test_FillPhysicalAttributeLabels() {
|
||||||
@@ -484,13 +276,10 @@ TestResults test_FillPhysicalAttributeLabels() {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill physical attribute labels", "no errors", make_tuple()),
|
||||||
"should fill physical attribute labels",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void FillSocialAttributeLabels(std::vector<std::string> socialAttributeLabels);
|
// void FillSocialAttributeLabels(std::vector<std::string> socialAttributeLabels);
|
||||||
TestResults test_FillSocialAttributeLabels() {
|
TestResults test_FillSocialAttributeLabels() {
|
||||||
return execute_suite<string>(make_test_suite(
|
return execute_suite<string>(make_test_suite(
|
||||||
@@ -508,13 +297,10 @@ TestResults test_FillSocialAttributeLabels() {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill social attribute labels", "no errors", make_tuple()),
|
||||||
"should fill social attribute labels",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// void FillMentalAttributeLabels(std::vector<std::string> mentalAttributeLabels);
|
// void FillMentalAttributeLabels(std::vector<std::string> mentalAttributeLabels);
|
||||||
TestResults test_FillMentalAttributeLabels() {
|
TestResults test_FillMentalAttributeLabels() {
|
||||||
return execute_suite<string>(make_test_suite(
|
return execute_suite<string>(make_test_suite(
|
||||||
@@ -532,11 +318,7 @@ TestResults test_FillMentalAttributeLabels() {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill mental attribute labels", "no errors", make_tuple()),
|
||||||
"should fill mental attribute labels",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace Test::Attributes
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "Backgrounds.h"
|
#include "Backgrounds.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|||||||
@@ -60,5 +60,6 @@ namespace SBF {
|
|||||||
/// @param background_labels The vector to fill. It will be emptied first.
|
/// @param background_labels The vector to fill. It will be emptied first.
|
||||||
void FillBackgroundLabels(std::vector<std::string>& background_labels);
|
void FillBackgroundLabels(std::vector<std::string>& background_labels);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined BACKGROUNDS_H__
|
#endif // End !defined BACKGROUNDS_H__
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "Backgrounds.h"
|
#include "Backgrounds.h"
|
||||||
#include "test.h"
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <tuple>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
@@ -12,7 +14,8 @@ using namespace std;
|
|||||||
namespace Test::Backgrounds {
|
namespace Test::Backgrounds {
|
||||||
TestResults test_GetBackgroundLabel();
|
TestResults test_GetBackgroundLabel();
|
||||||
TestResults test_FillBackgroundLabels();
|
TestResults test_FillBackgroundLabels();
|
||||||
} // End namespace Test::Attributes
|
} // namespace Test::Backgrounds
|
||||||
|
|
||||||
using namespace Test::Backgrounds;
|
using namespace Test::Backgrounds;
|
||||||
|
|
||||||
TestResults main_test_Backgrounds(int argc, char** argv) {
|
TestResults main_test_Backgrounds(int argc, char** argv) {
|
||||||
@@ -30,56 +33,27 @@ TestResults test_GetBackgroundLabel() {
|
|||||||
"SBF::GetBackgroundLabel",
|
"SBF::GetBackgroundLabel",
|
||||||
GetBackgroundLabel,
|
GetBackgroundLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
|
make_test<string, int>("should get \"\" for invalid background 0", "", make_tuple(0)),
|
||||||
make_test<string, int>(
|
make_test<string, int>(
|
||||||
"should get \"\" for invalid background 0",
|
"should get \"Allies\" for background 1 kBackgroundAlliesLabel", "Allies", make_tuple(1)),
|
||||||
"",
|
|
||||||
make_tuple(0)),
|
|
||||||
make_test<string, int>(
|
make_test<string, int>(
|
||||||
"should get \"Allies\" for background 1 kBackgroundAlliesLabel",
|
"should get \"Contacts\" for background 2 kBackgroundContactsLabel", "Contacts", make_tuple(2)),
|
||||||
"Allies",
|
make_test<string, int>("should get \"Fame\" for background 3 kBackgroundFameLabel", "Fame", make_tuple(3)),
|
||||||
make_tuple(1)),
|
|
||||||
make_test<string, int>(
|
make_test<string, int>(
|
||||||
"should get \"Contacts\" for background 2 kBackgroundContactsLabel",
|
"should get \"Generation\" for background 4 kBackgroundGenerationLabel", "Generation", make_tuple(4)),
|
||||||
"Contacts",
|
make_test<string, int>("should get \"Herd\" for background 5 kBackgroundHerdLabel", "Herd", make_tuple(5)),
|
||||||
make_tuple(2)),
|
|
||||||
make_test<string, int>(
|
make_test<string, int>(
|
||||||
"should get \"Fame\" for background 3 kBackgroundFameLabel",
|
"should get \"Influence\" for background 6 kBackgroundInfluenceLabel", "Influence", make_tuple(6)),
|
||||||
"Fame",
|
|
||||||
make_tuple(3)),
|
|
||||||
make_test<string, int>(
|
make_test<string, int>(
|
||||||
"should get \"Generation\" for background 4 kBackgroundGenerationLabel",
|
"should get \"Mentor\" for background 7 kBackgroundMentorLabel", "Mentor", make_tuple(7)),
|
||||||
"Generation",
|
|
||||||
make_tuple(4)),
|
|
||||||
make_test<string, int>(
|
make_test<string, int>(
|
||||||
"should get \"Herd\" for background 5 kBackgroundHerdLabel",
|
"should get \"Resources\" for background 8 kBackgroundResourcesLabel", "Resources", make_tuple(8)),
|
||||||
"Herd",
|
|
||||||
make_tuple(5)),
|
|
||||||
make_test<string, int>(
|
make_test<string, int>(
|
||||||
"should get \"Influence\" for background 6 kBackgroundInfluenceLabel",
|
"should get \"Retainers\" for background 9 kBackgroundRetainersLabel", "Retainers", make_tuple(9)),
|
||||||
"Influence",
|
|
||||||
make_tuple(6)),
|
|
||||||
make_test<string, int>(
|
make_test<string, int>(
|
||||||
"should get \"Mentor\" for background 7 kBackgroundMentorLabel",
|
"should get \"Status\" for background 10 kBackgroundStatusLabel", "Status", make_tuple(10)),
|
||||||
"Mentor",
|
make_test<string, int>("should get \"\" for invalid background 11", "", make_tuple(11)),
|
||||||
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)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillBackgroundLabels() {
|
TestResults test_FillBackgroundLabels() {
|
||||||
@@ -87,7 +61,16 @@ TestResults test_FillBackgroundLabels() {
|
|||||||
"SBF::FillBackgroundLabels",
|
"SBF::FillBackgroundLabels",
|
||||||
[]() -> string {
|
[]() -> string {
|
||||||
ostringstream error_message;
|
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."};
|
vector<string> actual = {"This should be removed."};
|
||||||
FillBackgroundLabels(actual);
|
FillBackgroundLabels(actual);
|
||||||
compare(error_message, expected, actual);
|
compare(error_message, expected, actual);
|
||||||
@@ -98,10 +81,7 @@ TestResults test_FillBackgroundLabels() {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill background labels", "no errors", make_tuple()),
|
||||||
"should fill background labels",
|
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -461,7 +461,6 @@ namespace SBF {
|
|||||||
case kTalentSubterfugeId:
|
case kTalentSubterfugeId:
|
||||||
talent_subterfuge = value;
|
talent_subterfuge = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -710,4 +709,3 @@ namespace SBF {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
@@ -8,18 +8,19 @@
|
|||||||
* Copyright 2023 Tom Hicks
|
* Copyright 2023 Tom Hicks
|
||||||
* Licensed under the MIT license see the LICENSE file for details.
|
* Licensed under the MIT license see the LICENSE file for details.
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
#include "Colors.h"
|
#include <cstdint>
|
||||||
#include "Ranks.h"
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "Abilities.h"
|
||||||
|
#include "Attributes.h"
|
||||||
|
#include "Backgrounds.h"
|
||||||
#include "Clans.h"
|
#include "Clans.h"
|
||||||
|
#include "Colors.h"
|
||||||
#include "Derangements.h"
|
#include "Derangements.h"
|
||||||
#include "Disciplines.h"
|
#include "Disciplines.h"
|
||||||
|
#include "Ranks.h"
|
||||||
#include "Virtues.h"
|
#include "Virtues.h"
|
||||||
#include "Attributes.h"
|
|
||||||
#include "Abilities.h"
|
|
||||||
#include "Backgrounds.h"
|
|
||||||
#include <string>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
/** \addtogroup Character
|
/** \addtogroup Character
|
||||||
* @{
|
* @{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "Clans.h"
|
#include "Clans.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|||||||
@@ -83,5 +83,6 @@ namespace SBF {
|
|||||||
/// @param clans The vector to fill. It will be emptied first.
|
/// @param clans The vector to fill. It will be emptied first.
|
||||||
void FillClanLabels(std::vector<std::string>& clans);
|
void FillClanLabels(std::vector<std::string>& clans);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined CLANS_H__
|
#endif // End !defined CLANS_H__
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "Clans.h"
|
#include "Clans.h"
|
||||||
#include "test.h"
|
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
@@ -13,6 +15,7 @@ namespace Test::Clans {
|
|||||||
TestResults test_GetClanLabel();
|
TestResults test_GetClanLabel();
|
||||||
TestResults test_FillClanLabels();
|
TestResults test_FillClanLabels();
|
||||||
} // End namespace Test::Clans
|
} // End namespace Test::Clans
|
||||||
|
|
||||||
using namespace Test::Clans;
|
using namespace Test::Clans;
|
||||||
|
|
||||||
TestResults main_test_Clans(int argc, char** argv) {
|
TestResults main_test_Clans(int argc, char** argv) {
|
||||||
@@ -30,88 +33,28 @@ TestResults test_GetClanLabel() {
|
|||||||
"SBF::GetClanLabel",
|
"SBF::GetClanLabel",
|
||||||
GetClanLabel,
|
GetClanLabel,
|
||||||
vector<TestTuple<string, int>>({
|
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>(
|
make_test<string, int>(
|
||||||
"should get \"\" for invalid clan 0",
|
"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_tuple(0)),
|
make_test<string, int>("should get \"Giovanni\" for clan 8 kClanGiovanni", "Giovanni", make_tuple(8)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Inconnu\" for clan 9 kClanInconnu", "Inconnu", make_tuple(9)),
|
||||||
"should get \"Anarch\" for clan 1 kClanAnarch",
|
make_test<string, int>("should get \"Lasombra\" for clan 10 kClanLasombra", "Lasombra", make_tuple(10)),
|
||||||
"Anarch",
|
make_test<string, int>("should get \"Malkavian\" for clan 11 kClanMalkavian", "Malkavian", make_tuple(11)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get \"Nosferatu\" for clan 12 kClanNosferatu", "Nosferatu", make_tuple(12)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Ravanos\" for clan 13 kClanRavanos", "Ravanos", make_tuple(13)),
|
||||||
"should get \"Assamite\" for clan 2 kClanAssamite",
|
make_test<string, int>("should get \"Settite\" for clan 14 kClanSettite", "Settite", make_tuple(14)),
|
||||||
"Assamite",
|
make_test<string, int>("should get \"Toreador\" for clan 15 kClanToreador", "Toreador", make_tuple(15)),
|
||||||
make_tuple(2)),
|
make_test<string, int>("should get \"Tremere\" for clan 16 kClanTremere", "Tremere", make_tuple(16)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Tzismice\" for clan 17 kClanTzismice", "Tzismice", make_tuple(17)),
|
||||||
"should get \"Baali\" for clan 3 kClanBaali",
|
make_test<string, int>("should get \"Ventrue\" for clan 18 kClanVentrue", "Ventrue", make_tuple(18)),
|
||||||
"Baali",
|
make_test<string, int>("should get \"\" for invalid clan 19", "", make_tuple(19)),
|
||||||
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)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillClanLabels() {
|
TestResults test_FillClanLabels() {
|
||||||
@@ -119,7 +62,24 @@ TestResults test_FillClanLabels() {
|
|||||||
"SBF::FillClanLabels",
|
"SBF::FillClanLabels",
|
||||||
[]() -> string {
|
[]() -> string {
|
||||||
ostringstream error_message;
|
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."};
|
vector<string> actual = {"This should be removed."};
|
||||||
FillClanLabels(actual);
|
FillClanLabels(actual);
|
||||||
compare(error_message, expected, actual);
|
compare(error_message, expected, actual);
|
||||||
@@ -130,10 +90,7 @@ TestResults test_FillClanLabels() {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill clan labels", "no errors", make_tuple()),
|
||||||
"should fill clan labels",
|
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
})
|
||||||
|
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -54,5 +54,6 @@ namespace SBF {
|
|||||||
/// @param colors The vector to fill.
|
/// @param colors The vector to fill.
|
||||||
void FillColors(std::vector<uint8_t>& colors);
|
void FillColors(std::vector<uint8_t>& colors);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined COLORS_H__
|
#endif // End !defined COLORS_H__
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "Colors.h"
|
#include "Colors.h"
|
||||||
#include "test.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -15,11 +17,14 @@ TestResults test_GetForegroundColor();
|
|||||||
TestResults test_SetBackgroundColor();
|
TestResults test_SetBackgroundColor();
|
||||||
TestResults test_SetForegroundColor();
|
TestResults test_SetForegroundColor();
|
||||||
} // End namespace Test::Colors
|
} // End namespace Test::Colors
|
||||||
|
|
||||||
using namespace Test::Colors;
|
using namespace Test::Colors;
|
||||||
|
|
||||||
namespace SBF {
|
namespace SBF {
|
||||||
extern uint8_t g_foregroundColor;
|
extern uint8_t g_foregroundColor;
|
||||||
extern uint8_t g_backgroundColor;
|
extern uint8_t g_backgroundColor;
|
||||||
}
|
} // namespace SBF
|
||||||
|
|
||||||
TestResults main_test_Colors(int argc, char** argv) {
|
TestResults main_test_Colors(int argc, char** argv) {
|
||||||
TestResults results;
|
TestResults results;
|
||||||
|
|
||||||
@@ -31,6 +36,7 @@ TestResults main_test_Colors(int argc, char** argv) {
|
|||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Test::Colors {
|
namespace Test::Colors {
|
||||||
TestResults test_FillColors() {
|
TestResults test_FillColors() {
|
||||||
return execute_suite<string>(make_test_suite(
|
return execute_suite<string>(make_test_suite(
|
||||||
@@ -48,12 +54,8 @@ TestResults test_FillColors() {
|
|||||||
return "no errors";
|
return "no errors";
|
||||||
},
|
},
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill colors", "no errors", make_tuple()),
|
||||||
"should fill colors",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_GetBackgroundColor() {
|
TestResults test_GetBackgroundColor() {
|
||||||
@@ -66,79 +68,42 @@ TestResults test_GetBackgroundColor() {
|
|||||||
fnToTest,
|
fnToTest,
|
||||||
vector<TestTuple<uint32_t, uint32_t>>({
|
vector<TestTuple<uint32_t, uint32_t>>({
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkBlack when background color is 0",
|
"should get kColorDarkBlack when background color is 0", kColorDarkBlack, make_tuple(0U)),
|
||||||
kColorDarkBlack,
|
|
||||||
make_tuple(0U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkBlue when background color is 1",
|
"should get kColorDarkBlue when background color is 1", kColorDarkBlue, make_tuple(1U)),
|
||||||
kColorDarkBlue,
|
|
||||||
make_tuple(1U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkGreen when background color is 2",
|
"should get kColorDarkGreen when background color is 2", kColorDarkGreen, make_tuple(2U)),
|
||||||
kColorDarkGreen,
|
|
||||||
make_tuple(2U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkCyan when background color is 3",
|
"should get kColorDarkCyan when background color is 3", kColorDarkCyan, make_tuple(3U)),
|
||||||
kColorDarkCyan,
|
|
||||||
make_tuple(3U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkRed when background color is 4",
|
"should get kColorDarkRed when background color is 4", kColorDarkRed, make_tuple(4U)),
|
||||||
kColorDarkRed,
|
|
||||||
make_tuple(4U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkMagenta when background color is 5",
|
"should get kColorDarkMagenta when background color is 5", kColorDarkMagenta, make_tuple(5U)),
|
||||||
kColorDarkMagenta,
|
|
||||||
make_tuple(5U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkOrange when background color is 6",
|
"should get kColorDarkOrange when background color is 6", kColorDarkOrange, make_tuple(6U)),
|
||||||
kColorDarkOrange,
|
|
||||||
make_tuple(6U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkYellow when background color is 6",
|
"should get kColorDarkYellow when background color is 6", kColorDarkYellow, make_tuple(6U)),
|
||||||
kColorDarkYellow,
|
|
||||||
make_tuple(6U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkWhite when background color is 7",
|
"should get kColorDarkWhite when background color is 7", kColorDarkWhite, make_tuple(7U)),
|
||||||
kColorDarkWhite,
|
|
||||||
make_tuple(7U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightBlack when background color is 8",
|
"should get kColorBrightBlack when background color is 8", kColorBrightBlack, make_tuple(8U)),
|
||||||
kColorBrightBlack,
|
|
||||||
make_tuple(8U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightBlue when background color is 9",
|
"should get kColorBrightBlue when background color is 9", kColorBrightBlue, make_tuple(9U)),
|
||||||
kColorBrightBlue,
|
|
||||||
make_tuple(9U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightGreen when background color is 10",
|
"should get kColorBrightGreen when background color is 10", kColorBrightGreen, make_tuple(10U)),
|
||||||
kColorBrightGreen,
|
|
||||||
make_tuple(10U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightCyan when background color is 11",
|
"should get kColorBrightCyan when background color is 11", kColorBrightCyan, make_tuple(11U)),
|
||||||
kColorBrightCyan,
|
|
||||||
make_tuple(11U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightRed when background color is 12",
|
"should get kColorBrightRed when background color is 12", kColorBrightRed, make_tuple(12U)),
|
||||||
kColorBrightRed,
|
|
||||||
make_tuple(12U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightMagenta when background color is 13",
|
"should get kColorBrightMagenta when background color is 13", kColorBrightMagenta, make_tuple(13U)),
|
||||||
kColorBrightMagenta,
|
|
||||||
make_tuple(13U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightOrange when background color is 14",
|
"should get kColorBrightOrange when background color is 14", kColorBrightOrange, make_tuple(14U)),
|
||||||
kColorBrightOrange,
|
|
||||||
make_tuple(14U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightYellow when background color is 14",
|
"should get kColorBrightYellow when background color is 14", kColorBrightYellow, make_tuple(14U)),
|
||||||
kColorBrightYellow,
|
|
||||||
make_tuple(14U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightWhite when background color is 15",
|
"should get kColorBrightWhite when background color is 15", kColorBrightWhite, make_tuple(15U)),
|
||||||
kColorBrightWhite,
|
})));
|
||||||
make_tuple(15U)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_GetForegroundColor() {
|
TestResults test_GetForegroundColor() {
|
||||||
@@ -151,79 +116,42 @@ TestResults test_GetForegroundColor() {
|
|||||||
fnToTest,
|
fnToTest,
|
||||||
vector<TestTuple<uint32_t, uint32_t>>({
|
vector<TestTuple<uint32_t, uint32_t>>({
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkBlack when foreground color is 0",
|
"should get kColorDarkBlack when foreground color is 0", kColorDarkBlack, make_tuple(0U)),
|
||||||
kColorDarkBlack,
|
|
||||||
make_tuple(0U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkBlue when foreground color is 1",
|
"should get kColorDarkBlue when foreground color is 1", kColorDarkBlue, make_tuple(1U)),
|
||||||
kColorDarkBlue,
|
|
||||||
make_tuple(1U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkGreen when foreground color is 2",
|
"should get kColorDarkGreen when foreground color is 2", kColorDarkGreen, make_tuple(2U)),
|
||||||
kColorDarkGreen,
|
|
||||||
make_tuple(2U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkCyan when foreground color is 3",
|
"should get kColorDarkCyan when foreground color is 3", kColorDarkCyan, make_tuple(3U)),
|
||||||
kColorDarkCyan,
|
|
||||||
make_tuple(3U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkRed when foreground color is 4",
|
"should get kColorDarkRed when foreground color is 4", kColorDarkRed, make_tuple(4U)),
|
||||||
kColorDarkRed,
|
|
||||||
make_tuple(4U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkMagenta when foreground color is 5",
|
"should get kColorDarkMagenta when foreground color is 5", kColorDarkMagenta, make_tuple(5U)),
|
||||||
kColorDarkMagenta,
|
|
||||||
make_tuple(5U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkOrange when foreground color is 6",
|
"should get kColorDarkOrange when foreground color is 6", kColorDarkOrange, make_tuple(6U)),
|
||||||
kColorDarkOrange,
|
|
||||||
make_tuple(6U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkYellow when foreground color is 6",
|
"should get kColorDarkYellow when foreground color is 6", kColorDarkYellow, make_tuple(6U)),
|
||||||
kColorDarkYellow,
|
|
||||||
make_tuple(6U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorDarkWhite when foreground color is 7",
|
"should get kColorDarkWhite when foreground color is 7", kColorDarkWhite, make_tuple(7U)),
|
||||||
kColorDarkWhite,
|
|
||||||
make_tuple(7U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightBlack when foreground color is 8",
|
"should get kColorBrightBlack when foreground color is 8", kColorBrightBlack, make_tuple(8U)),
|
||||||
kColorBrightBlack,
|
|
||||||
make_tuple(8U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightBlue when foreground color is 9",
|
"should get kColorBrightBlue when foreground color is 9", kColorBrightBlue, make_tuple(9U)),
|
||||||
kColorBrightBlue,
|
|
||||||
make_tuple(9U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightGreen when foreground color is 10",
|
"should get kColorBrightGreen when foreground color is 10", kColorBrightGreen, make_tuple(10U)),
|
||||||
kColorBrightGreen,
|
|
||||||
make_tuple(10U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightCyan when foreground color is 11",
|
"should get kColorBrightCyan when foreground color is 11", kColorBrightCyan, make_tuple(11U)),
|
||||||
kColorBrightCyan,
|
|
||||||
make_tuple(11U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightRed when foreground color is 12",
|
"should get kColorBrightRed when foreground color is 12", kColorBrightRed, make_tuple(12U)),
|
||||||
kColorBrightRed,
|
|
||||||
make_tuple(12U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightMagenta when foreground color is 13",
|
"should get kColorBrightMagenta when foreground color is 13", kColorBrightMagenta, make_tuple(13U)),
|
||||||
kColorBrightMagenta,
|
|
||||||
make_tuple(13U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightOrange when foreground color is 14",
|
"should get kColorBrightOrange when foreground color is 14", kColorBrightOrange, make_tuple(14U)),
|
||||||
kColorBrightOrange,
|
|
||||||
make_tuple(14U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightYellow when foreground color is 14",
|
"should get kColorBrightYellow when foreground color is 14", kColorBrightYellow, make_tuple(14U)),
|
||||||
kColorBrightYellow,
|
|
||||||
make_tuple(14U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should get kColorBrightWhite when foreground color is 15",
|
"should get kColorBrightWhite when foreground color is 15", kColorBrightWhite, make_tuple(15U)),
|
||||||
kColorBrightWhite,
|
})));
|
||||||
make_tuple(15U)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_SetBackgroundColor() {
|
TestResults test_SetBackgroundColor() {
|
||||||
@@ -237,79 +165,45 @@ TestResults test_SetBackgroundColor() {
|
|||||||
fnToTest,
|
fnToTest,
|
||||||
vector<TestTuple<uint32_t, uint32_t>>({
|
vector<TestTuple<uint32_t, uint32_t>>({
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorDarkBlack when color is 0",
|
"should set background color to kColorDarkBlack when color is 0", kColorDarkBlack, make_tuple(0U)),
|
||||||
kColorDarkBlack,
|
|
||||||
make_tuple(0U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorDarkBlue when color is 1",
|
"should set background color to kColorDarkBlue when color is 1", kColorDarkBlue, make_tuple(1U)),
|
||||||
kColorDarkBlue,
|
|
||||||
make_tuple(1U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorDarkGreen when color is 2",
|
"should set background color to kColorDarkGreen when color is 2", kColorDarkGreen, make_tuple(2U)),
|
||||||
kColorDarkGreen,
|
|
||||||
make_tuple(2U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorDarkCyan when color is 3",
|
"should set background color to kColorDarkCyan when color is 3", kColorDarkCyan, make_tuple(3U)),
|
||||||
kColorDarkCyan,
|
|
||||||
make_tuple(3U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorDarkRed when color is 4",
|
"should set background color to kColorDarkRed when color is 4", kColorDarkRed, make_tuple(4U)),
|
||||||
kColorDarkRed,
|
|
||||||
make_tuple(4U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorDarkMagenta when color is 5",
|
"should set background color to kColorDarkMagenta when color is 5", kColorDarkMagenta, make_tuple(5U)),
|
||||||
kColorDarkMagenta,
|
|
||||||
make_tuple(5U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorDarkOrange when color is 6",
|
"should set background color to kColorDarkOrange when color is 6", kColorDarkOrange, make_tuple(6U)),
|
||||||
kColorDarkOrange,
|
|
||||||
make_tuple(6U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorDarkYellow when color is 6",
|
"should set background color to kColorDarkYellow when color is 6", kColorDarkYellow, make_tuple(6U)),
|
||||||
kColorDarkYellow,
|
|
||||||
make_tuple(6U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorDarkWhite when color is 7",
|
"should set background color to kColorDarkWhite when color is 7", kColorDarkWhite, make_tuple(7U)),
|
||||||
kColorDarkWhite,
|
|
||||||
make_tuple(7U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorBrightBlack when color is 8",
|
"should set background color to kColorBrightBlack when color is 8", kColorBrightBlack, make_tuple(8U)),
|
||||||
kColorBrightBlack,
|
|
||||||
make_tuple(8U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorBrightBlue when color is 9",
|
"should set background color to kColorBrightBlue when color is 9", kColorBrightBlue, make_tuple(9U)),
|
||||||
kColorBrightBlue,
|
|
||||||
make_tuple(9U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorBrightGreen when color is 10",
|
"should set background color to kColorBrightGreen when color is 10", kColorBrightGreen, make_tuple(10U)),
|
||||||
kColorBrightGreen,
|
|
||||||
make_tuple(10U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorBrightCyan when color is 11",
|
"should set background color to kColorBrightCyan when color is 11", kColorBrightCyan, make_tuple(11U)),
|
||||||
kColorBrightCyan,
|
|
||||||
make_tuple(11U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorBrightRed when color is 12",
|
"should set background color to kColorBrightRed when color is 12", kColorBrightRed, make_tuple(12U)),
|
||||||
kColorBrightRed,
|
make_test<uint32_t, uint32_t>("should set background color to kColorBrightMagenta when color is 13",
|
||||||
make_tuple(12U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
|
||||||
"should set background color to kColorBrightMagenta when color is 13",
|
|
||||||
kColorBrightMagenta,
|
kColorBrightMagenta,
|
||||||
make_tuple(13U)),
|
make_tuple(13U)),
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>("should set background color to kColorBrightOrange when color is 14",
|
||||||
"should set background color to kColorBrightOrange when color is 14",
|
|
||||||
kColorBrightOrange,
|
kColorBrightOrange,
|
||||||
make_tuple(14U)),
|
make_tuple(14U)),
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>("should set background color to kColorBrightYellow when color is 14",
|
||||||
"should set background color to kColorBrightYellow when color is 14",
|
|
||||||
kColorBrightYellow,
|
kColorBrightYellow,
|
||||||
make_tuple(14U)),
|
make_tuple(14U)),
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set background color to kColorBrightWhite when color is 15",
|
"should set background color to kColorBrightWhite when color is 15", kColorBrightWhite, make_tuple(15U)),
|
||||||
kColorBrightWhite,
|
})));
|
||||||
make_tuple(15U)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_SetForegroundColor() {
|
TestResults test_SetForegroundColor() {
|
||||||
@@ -323,78 +217,44 @@ TestResults test_SetForegroundColor() {
|
|||||||
fnToTest,
|
fnToTest,
|
||||||
vector<TestTuple<uint32_t, uint32_t>>({
|
vector<TestTuple<uint32_t, uint32_t>>({
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorDarkBlack when color is 0",
|
"should set foreground color to kColorDarkBlack when color is 0", kColorDarkBlack, make_tuple(0U)),
|
||||||
kColorDarkBlack,
|
|
||||||
make_tuple(0U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorDarkBlue when color is 1",
|
"should set foreground color to kColorDarkBlue when color is 1", kColorDarkBlue, make_tuple(1U)),
|
||||||
kColorDarkBlue,
|
|
||||||
make_tuple(1U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorDarkGreen when color is 2",
|
"should set foreground color to kColorDarkGreen when color is 2", kColorDarkGreen, make_tuple(2U)),
|
||||||
kColorDarkGreen,
|
|
||||||
make_tuple(2U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorDarkCyan when color is 3",
|
"should set foreground color to kColorDarkCyan when color is 3", kColorDarkCyan, make_tuple(3U)),
|
||||||
kColorDarkCyan,
|
|
||||||
make_tuple(3U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorDarkRed when color is 4",
|
"should set foreground color to kColorDarkRed when color is 4", kColorDarkRed, make_tuple(4U)),
|
||||||
kColorDarkRed,
|
|
||||||
make_tuple(4U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorDarkMagenta when color is 5",
|
"should set foreground color to kColorDarkMagenta when color is 5", kColorDarkMagenta, make_tuple(5U)),
|
||||||
kColorDarkMagenta,
|
|
||||||
make_tuple(5U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorDarkOrange when color is 6",
|
"should set foreground color to kColorDarkOrange when color is 6", kColorDarkOrange, make_tuple(6U)),
|
||||||
kColorDarkOrange,
|
|
||||||
make_tuple(6U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorDarkYellow when color is 6",
|
"should set foreground color to kColorDarkYellow when color is 6", kColorDarkYellow, make_tuple(6U)),
|
||||||
kColorDarkYellow,
|
|
||||||
make_tuple(6U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorDarkWhite when color is 7",
|
"should set foreground color to kColorDarkWhite when color is 7", kColorDarkWhite, make_tuple(7U)),
|
||||||
kColorDarkWhite,
|
|
||||||
make_tuple(7U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorBrightBlack when color is 8",
|
"should set foreground color to kColorBrightBlack when color is 8", kColorBrightBlack, make_tuple(8U)),
|
||||||
kColorBrightBlack,
|
|
||||||
make_tuple(8U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorBrightBlue when color is 9",
|
"should set foreground color to kColorBrightBlue when color is 9", kColorBrightBlue, make_tuple(9U)),
|
||||||
kColorBrightBlue,
|
|
||||||
make_tuple(9U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorBrightGreen when color is 10",
|
"should set foreground color to kColorBrightGreen when color is 10", kColorBrightGreen, make_tuple(10U)),
|
||||||
kColorBrightGreen,
|
|
||||||
make_tuple(10U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorBrightCyan when color is 11",
|
"should set foreground color to kColorBrightCyan when color is 11", kColorBrightCyan, make_tuple(11U)),
|
||||||
kColorBrightCyan,
|
|
||||||
make_tuple(11U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorBrightRed when color is 12",
|
"should set foreground color to kColorBrightRed when color is 12", kColorBrightRed, make_tuple(12U)),
|
||||||
kColorBrightRed,
|
make_test<uint32_t, uint32_t>("should set foreground color to kColorBrightMagenta when color is 13",
|
||||||
make_tuple(12U)),
|
|
||||||
make_test<uint32_t, uint32_t>(
|
|
||||||
"should set foreground color to kColorBrightMagenta when color is 13",
|
|
||||||
kColorBrightMagenta,
|
kColorBrightMagenta,
|
||||||
make_tuple(13U)),
|
make_tuple(13U)),
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>("should set foreground color to kColorBrightOrange when color is 14",
|
||||||
"should set foreground color to kColorBrightOrange when color is 14",
|
|
||||||
kColorBrightOrange,
|
kColorBrightOrange,
|
||||||
make_tuple(14U)),
|
make_tuple(14U)),
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>("should set foreground color to kColorBrightYellow when color is 14",
|
||||||
"should set foreground color to kColorBrightYellow when color is 14",
|
|
||||||
kColorBrightYellow,
|
kColorBrightYellow,
|
||||||
make_tuple(14U)),
|
make_tuple(14U)),
|
||||||
make_test<uint32_t, uint32_t>(
|
make_test<uint32_t, uint32_t>(
|
||||||
"should set foreground color to kColorBrightWhite when color is 15",
|
"should set foreground color to kColorBrightWhite when color is 15", kColorBrightWhite, make_tuple(15U)),
|
||||||
kColorBrightWhite,
|
})));
|
||||||
make_tuple(15U)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
} // End namespace Test::Colors
|
} // End namespace Test::Colors
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "Derangements.h"
|
#include "Derangements.h"
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
@@ -6,10 +7,8 @@ namespace SBF {
|
|||||||
using std::ostream;
|
using std::ostream;
|
||||||
|
|
||||||
bool operator==(const DerangementType& left, const DerangementType& right) {
|
bool operator==(const DerangementType& left, const DerangementType& right) {
|
||||||
return left.description == right.description &&
|
return left.description == right.description && left.id == right.id && left.label == right.label
|
||||||
left.id == right.id &&
|
&& left.textColor == right.textColor;
|
||||||
left.label == right.label &&
|
|
||||||
left.textColor == right.textColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool operator!=(const DerangementType& left, const DerangementType& right) {
|
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) {
|
ostream& operator<<(ostream& os, const DerangementType& derangement) {
|
||||||
//Derangement: {id: 1, label: \"kDerangementAmnesiaLabel\", description: \"kDerangementAmnesiaDescription\", textColor: kDerangementAmnesiaTextColor}
|
// Derangement: {id: 1, label: \"kDerangementAmnesiaLabel\", description: \"kDerangementAmnesiaDescription\",
|
||||||
os << "Derangement: {id: " << derangement.id
|
// textColor: kDerangementAmnesiaTextColor}
|
||||||
<< ", label: \"" << derangement.label
|
os << "Derangement: {id: " << derangement.id << ", label: \"" << derangement.label << "\", description: \""
|
||||||
<< "\", description: \"" << derangement.description
|
<< derangement.description << "\", textColor: " << (int)derangement.textColor << "}";
|
||||||
<< "\", textColor: " << (int)derangement.textColor << "}";
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ namespace SBF {
|
|||||||
const int kDerangementAmnesiaId = 1;
|
const int kDerangementAmnesiaId = 1;
|
||||||
const uint8_t kDerangementAmnesiaTextColor = kColorDarkRed;
|
const uint8_t kDerangementAmnesiaTextColor = kColorDarkRed;
|
||||||
const std::string kDerangementAmnesiaLabel = "Amnesia";
|
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 int kDerangementDelusionsOfGrandeurId = 2;
|
||||||
const uint8_t kDerangementDelusionsOfGrandeurTextColor = kColorDarkMagenta;
|
const uint8_t kDerangementDelusionsOfGrandeurTextColor = kColorDarkMagenta;
|
||||||
const std::string kDerangementDelusionsOfGrandeurLabel = "Delusions of Grandeur";
|
const std::string kDerangementDelusionsOfGrandeurLabel = "Delusions of Grandeur";
|
||||||
@@ -34,15 +35,18 @@ namespace SBF {
|
|||||||
const int kDerangementFantasyId = 3;
|
const int kDerangementFantasyId = 3;
|
||||||
const uint8_t kDerangementFantasyTextColor = kColorDarkOrange;
|
const uint8_t kDerangementFantasyTextColor = kColorDarkOrange;
|
||||||
const std::string kDerangementFantasyLabel = "Fantasy";
|
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 int kDerangementManicDepressionId = 4;
|
||||||
const uint8_t kDerangementManicDepressionTextColor = kColorDarkWhite;
|
const uint8_t kDerangementManicDepressionTextColor = kColorDarkWhite;
|
||||||
const std::string kDerangementManicDepressionLabel = "Manic-Depression";
|
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 int kDerangementMultiplePersonalitiesId = 5;
|
||||||
const uint8_t kDerangementMultiplePersonalitiesTextColor = kColorDarkBlue;
|
const uint8_t kDerangementMultiplePersonalitiesTextColor = kColorDarkBlue;
|
||||||
const std::string kDerangementMultiplePersonalitiesLabel = "Multiple Personalities";
|
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 int kDerangementObsessionId = 6;
|
||||||
const uint8_t kDerangementObsessionTextColor = kColorBrightGreen;
|
const uint8_t kDerangementObsessionTextColor = kColorBrightGreen;
|
||||||
const std::string kDerangementObsessionLabel = "Obsession";
|
const std::string kDerangementObsessionLabel = "Obsession";
|
||||||
@@ -50,19 +54,23 @@ namespace SBF {
|
|||||||
const int kDerangementOvercompensationId = 7;
|
const int kDerangementOvercompensationId = 7;
|
||||||
const uint8_t kDerangementOvercompensationTextColor = kColorBrightCyan;
|
const uint8_t kDerangementOvercompensationTextColor = kColorBrightCyan;
|
||||||
const std::string kDerangementOvercompensationLabel = "Overcompensation";
|
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 int kDerangementParanoiaId = 8;
|
||||||
const uint8_t kDerangementParanoiaTextColor = kColorBrightRed;
|
const uint8_t kDerangementParanoiaTextColor = kColorBrightRed;
|
||||||
const std::string kDerangementParanoiaLabel = "Paranoia";
|
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 int kDerangementPerfectionId = 9;
|
||||||
const uint8_t kDerangementPerfectionTextColor = kColorBrightMagenta;
|
const uint8_t kDerangementPerfectionTextColor = kColorBrightMagenta;
|
||||||
const std::string kDerangementPerfectionLabel = "Perfection";
|
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 int kDerangementRegressionId = 10;
|
||||||
const uint8_t kDerangementRegressionTextColor = kColorBrightYellow;
|
const uint8_t kDerangementRegressionTextColor = kColorBrightYellow;
|
||||||
const std::string kDerangementRegressionLabel = "Regression";
|
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 kDerangementUnknown = {0, "", "", 0};
|
||||||
const DerangementType kDerangementAmnesia = {
|
const DerangementType kDerangementAmnesia = {
|
||||||
kDerangementAmnesiaId,
|
kDerangementAmnesiaId,
|
||||||
@@ -209,5 +217,6 @@ namespace SBF {
|
|||||||
/// @param derangements The vector to fill. It will be emptied first.
|
/// @param derangements The vector to fill. It will be emptied first.
|
||||||
void FillDerangements(std::vector<DerangementType>& derangements);
|
void FillDerangements(std::vector<DerangementType>& derangements);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined DERANGEMENTS_H__
|
#endif // End !defined DERANGEMENTS_H__
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "Derangements.h"
|
#include "Derangements.h"
|
||||||
#include "test.h"
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <tuple>
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
@@ -15,7 +17,8 @@ TestResults test_DerangementType_operator_equal_to();
|
|||||||
TestResults test_DerangementType_operator_not_equal_to();
|
TestResults test_DerangementType_operator_not_equal_to();
|
||||||
TestResults test_GetDerangement();
|
TestResults test_GetDerangement();
|
||||||
TestResults test_FillDerangements();
|
TestResults test_FillDerangements();
|
||||||
} // End Test::Derangements
|
} // namespace Test::Derangements
|
||||||
|
|
||||||
using namespace Test::Derangements;
|
using namespace Test::Derangements;
|
||||||
|
|
||||||
TestResults main_test_Derangements(int argc, char** argv) {
|
TestResults main_test_Derangements(int argc, char** argv) {
|
||||||
@@ -29,62 +32,76 @@ TestResults main_test_Derangements(int argc, char** argv) {
|
|||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Test::Derangements {
|
namespace Test::Derangements {
|
||||||
TestResults test_GetDerangement() {
|
TestResults test_GetDerangement() {
|
||||||
return execute_suite<DerangementType, int>(make_test_suite(
|
return execute_suite<DerangementType, int>(make_test_suite(
|
||||||
"SBF::GetDerangement",
|
"SBF::GetDerangement",
|
||||||
GetDerangement,
|
GetDerangement,
|
||||||
vector<TestTuple<DerangementType, int>>({
|
vector<TestTuple<DerangementType, int>>({
|
||||||
make_test<DerangementType, int>(
|
make_test<DerangementType, int>("should get {0, "
|
||||||
"should get {0, "", "", 0} for invalid derangement id 0",
|
", "
|
||||||
|
", 0} for invalid derangement id 0",
|
||||||
{0, "", "", 0},
|
{0, "", "", 0},
|
||||||
make_tuple(0)),
|
make_tuple(0)),
|
||||||
make_test<DerangementType, int>(
|
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,
|
kDerangementAmnesia,
|
||||||
make_tuple(1)),
|
make_tuple(1)),
|
||||||
make_test<DerangementType, int>(
|
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,
|
kDerangementDelusionsOfGrandeur,
|
||||||
make_tuple(2)),
|
make_tuple(2)),
|
||||||
make_test<DerangementType, int>(
|
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,
|
kDerangementFantasy,
|
||||||
make_tuple(3)),
|
make_tuple(3)),
|
||||||
make_test<DerangementType, int>(
|
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,
|
kDerangementManicDepression,
|
||||||
make_tuple(4)),
|
make_tuple(4)),
|
||||||
make_test<DerangementType, int>(
|
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,
|
kDerangementMultiplePersonalities,
|
||||||
make_tuple(5)),
|
make_tuple(5)),
|
||||||
make_test<DerangementType, int>(
|
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,
|
kDerangementObsession,
|
||||||
make_tuple(6)),
|
make_tuple(6)),
|
||||||
make_test<DerangementType, int>(
|
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,
|
kDerangementOvercompensation,
|
||||||
make_tuple(7)),
|
make_tuple(7)),
|
||||||
make_test<DerangementType, int>(
|
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,
|
kDerangementParanoia,
|
||||||
make_tuple(8)),
|
make_tuple(8)),
|
||||||
make_test<DerangementType, int>(
|
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,
|
kDerangementPerfection,
|
||||||
make_tuple(9)),
|
make_tuple(9)),
|
||||||
make_test<DerangementType, int>(
|
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,
|
kDerangementRegression,
|
||||||
make_tuple(10)),
|
make_tuple(10)),
|
||||||
make_test<DerangementType, int>(
|
make_test<DerangementType, int>("should get {0, "
|
||||||
"should get {0, "", "", 0} for invalid derangement id 11",
|
", "
|
||||||
|
", 0} for invalid derangement id 11",
|
||||||
{0, "", "", 0},
|
{0, "", "", 0},
|
||||||
make_tuple(11)),
|
make_tuple(11)),
|
||||||
})
|
})));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillDerangements() {
|
TestResults test_FillDerangements() {
|
||||||
@@ -102,9 +119,7 @@ TestResults test_FillDerangements() {
|
|||||||
kDerangementPerfection,
|
kDerangementPerfection,
|
||||||
kDerangementRegression,
|
kDerangementRegression,
|
||||||
};
|
};
|
||||||
vector<DerangementType> actual = {
|
vector<DerangementType> actual = {{-1, "This should be removed.", "This should be removed.", 255}};
|
||||||
{-1, "This should be removed.", "This should be removed.", 255}
|
|
||||||
};
|
|
||||||
FillDerangements(actual);
|
FillDerangements(actual);
|
||||||
compare(error_message, expected, actual);
|
compare(error_message, expected, actual);
|
||||||
string error = error_message.str();
|
string error = error_message.str();
|
||||||
@@ -113,16 +128,12 @@ TestResults test_FillDerangements() {
|
|||||||
}
|
}
|
||||||
return "no errors";
|
return "no errors";
|
||||||
};
|
};
|
||||||
return execute_suite<string>(make_test_suite(
|
return execute_suite<string>(
|
||||||
"SBF::FillDerangements",
|
make_test_suite("SBF::FillDerangements",
|
||||||
fnToTest,
|
fnToTest,
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill derangements", "no errors", make_tuple()),
|
||||||
"should fill derangements",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_DerangementType_operator_extract() {
|
TestResults test_DerangementType_operator_extract() {
|
||||||
@@ -134,62 +145,67 @@ TestResults test_DerangementType_operator_extract() {
|
|||||||
return os.str();
|
return os.str();
|
||||||
},
|
},
|
||||||
vector<TestTuple<string, DerangementType>>({
|
vector<TestTuple<string, DerangementType>>({
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>("should print amnesia",
|
||||||
"should print amnesia",
|
"Derangement: {id: 1, label: \"" + kDerangementAmnesiaLabel
|
||||||
"Derangement: {id: 1, label: \"" + kDerangementAmnesiaLabel + "\", description: \"" + kDerangementAmnesiaDescription + "\", textColor: 4}",
|
+ "\", description: \"" + kDerangementAmnesiaDescription
|
||||||
|
+ "\", textColor: 4}",
|
||||||
make_tuple(kDerangementAmnesia)),
|
make_tuple(kDerangementAmnesia)),
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>("should print delusions of grandeur",
|
||||||
"should print delusions of grandeur",
|
"Derangement: {id: 2, label: \"" + kDerangementDelusionsOfGrandeurLabel
|
||||||
"Derangement: {id: 2, label: \"" + kDerangementDelusionsOfGrandeurLabel + "\", description: \"" + kDerangementDelusionsOfGrandeurDescription + "\", textColor: 5}",
|
+ "\", description: \"" + kDerangementDelusionsOfGrandeurDescription
|
||||||
|
+ "\", textColor: 5}",
|
||||||
make_tuple(kDerangementDelusionsOfGrandeur)),
|
make_tuple(kDerangementDelusionsOfGrandeur)),
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>("should print fantasy",
|
||||||
"should print fantasy",
|
"Derangement: {id: 3, label: \"" + kDerangementFantasyLabel
|
||||||
"Derangement: {id: 3, label: \"" + kDerangementFantasyLabel + "\", description: \"" + kDerangementFantasyDescription + "\", textColor: 6}",
|
+ "\", description: \"" + kDerangementFantasyDescription
|
||||||
|
+ "\", textColor: 6}",
|
||||||
make_tuple(kDerangementFantasy)),
|
make_tuple(kDerangementFantasy)),
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>("should print manic depression",
|
||||||
"should print manic depression",
|
"Derangement: {id: 4, label: \"" + kDerangementManicDepressionLabel
|
||||||
"Derangement: {id: 4, label: \"" + kDerangementManicDepressionLabel + "\", description: \"" + kDerangementManicDepressionDescription + "\", textColor: 7}",
|
+ "\", description: \"" + kDerangementManicDepressionDescription
|
||||||
|
+ "\", textColor: 7}",
|
||||||
make_tuple(kDerangementManicDepression)),
|
make_tuple(kDerangementManicDepression)),
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>("should print multiple personalities",
|
||||||
"should print multiple personalities",
|
"Derangement: {id: 5, label: \"" + kDerangementMultiplePersonalitiesLabel
|
||||||
"Derangement: {id: 5, label: \"" + kDerangementMultiplePersonalitiesLabel + "\", description: \"" + kDerangementMultiplePersonalitiesDescription + "\", textColor: 1}",
|
+ "\", description: \"" + kDerangementMultiplePersonalitiesDescription
|
||||||
|
+ "\", textColor: 1}",
|
||||||
make_tuple(kDerangementMultiplePersonalities)),
|
make_tuple(kDerangementMultiplePersonalities)),
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>("should print obsession",
|
||||||
"should print obsession",
|
"Derangement: {id: 6, label: \"" + kDerangementObsessionLabel
|
||||||
"Derangement: {id: 6, label: \"" + kDerangementObsessionLabel + "\", description: \"" + kDerangementObsessionDescription + "\", textColor: 10}",
|
+ "\", description: \"" + kDerangementObsessionDescription
|
||||||
|
+ "\", textColor: 10}",
|
||||||
make_tuple(kDerangementObsession)),
|
make_tuple(kDerangementObsession)),
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>("should print overcompensation",
|
||||||
"should print overcompensation",
|
"Derangement: {id: 7, label: \"" + kDerangementOvercompensationLabel
|
||||||
"Derangement: {id: 7, label: \"" + kDerangementOvercompensationLabel + "\", description: \"" + kDerangementOvercompensationDescription + "\", textColor: 11}",
|
+ "\", description: \"" + kDerangementOvercompensationDescription
|
||||||
|
+ "\", textColor: 11}",
|
||||||
make_tuple(kDerangementOvercompensation)),
|
make_tuple(kDerangementOvercompensation)),
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>("should print paranoia",
|
||||||
"should print paranoia",
|
"Derangement: {id: 8, label: \"" + kDerangementParanoiaLabel
|
||||||
"Derangement: {id: 8, label: \"" + kDerangementParanoiaLabel + "\", description: \"" + kDerangementParanoiaDescription + "\", textColor: 12}",
|
+ "\", description: \"" + kDerangementParanoiaDescription
|
||||||
|
+ "\", textColor: 12}",
|
||||||
make_tuple(kDerangementParanoia)),
|
make_tuple(kDerangementParanoia)),
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>("should print perfection",
|
||||||
"should print perfection",
|
"Derangement: {id: 9, label: \"" + kDerangementPerfectionLabel
|
||||||
"Derangement: {id: 9, label: \"" + kDerangementPerfectionLabel + "\", description: \"" + kDerangementPerfectionDescription + "\", textColor: 13}",
|
+ "\", description: \"" + kDerangementPerfectionDescription
|
||||||
|
+ "\", textColor: 13}",
|
||||||
make_tuple(kDerangementPerfection)),
|
make_tuple(kDerangementPerfection)),
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>("should print regression",
|
||||||
"should print regression",
|
"Derangement: {id: 10, label: \"" + kDerangementRegressionLabel
|
||||||
"Derangement: {id: 10, label: \"" + kDerangementRegressionLabel + "\", description: \"" + kDerangementRegressionDescription + "\", textColor: 14}",
|
+ "\", description: \"" + kDerangementRegressionDescription
|
||||||
|
+ "\", textColor: 14}",
|
||||||
make_tuple(kDerangementRegression)),
|
make_tuple(kDerangementRegression)),
|
||||||
make_test<string, DerangementType>(
|
make_test<string, DerangementType>(
|
||||||
"should print an unknown derangement",
|
"should print an unknown derangement",
|
||||||
"Derangement: {id: 0, label: \"MyLabel\", description: \"My Description\", textColor: 5}",
|
"Derangement: {id: 0, label: \"MyLabel\", description: \"My Description\", textColor: 5}",
|
||||||
make_tuple((DerangementType){
|
make_tuple((DerangementType){0, "MyLabel", "My Description", 5})),
|
||||||
0, "MyLabel", "My Description", 5})),
|
})));
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_DerangementType_operator_equal_to() {
|
TestResults test_DerangementType_operator_equal_to() {
|
||||||
return execute_suite<bool, DerangementType, DerangementType>(
|
return execute_suite<bool, DerangementType, DerangementType>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::DerangementType::operator==",
|
"SBF::DerangementType::operator==",
|
||||||
[](const DerangementType& left, const DerangementType& right) {
|
[](const DerangementType& left, const DerangementType& right) { return left == right; },
|
||||||
return left == right;
|
|
||||||
},
|
|
||||||
vector<TestTuple<bool, DerangementType, DerangementType>>({
|
vector<TestTuple<bool, DerangementType, DerangementType>>({
|
||||||
make_test<bool, DerangementType, DerangementType>(
|
make_test<bool, DerangementType, DerangementType>(
|
||||||
"should return true when comparing a derangement to itself",
|
"should return true when comparing a derangement to itself",
|
||||||
@@ -198,22 +214,22 @@ TestResults test_DerangementType_operator_equal_to() {
|
|||||||
make_test<bool, DerangementType, DerangementType>(
|
make_test<bool, DerangementType, DerangementType>(
|
||||||
"should return true when comparing two different instances created with the same values",
|
"should return true when comparing two different instances created with the same values",
|
||||||
true,
|
true,
|
||||||
make_tuple(kDerangementFantasy, DerangementType({kDerangementFantasyId, kDerangementFantasyLabel, kDerangementFantasyDescription, kDerangementFantasyTextColor}))),
|
make_tuple(kDerangementFantasy,
|
||||||
|
DerangementType({kDerangementFantasyId,
|
||||||
|
kDerangementFantasyLabel,
|
||||||
|
kDerangementFantasyDescription,
|
||||||
|
kDerangementFantasyTextColor}))),
|
||||||
make_test<bool, DerangementType, DerangementType>(
|
make_test<bool, DerangementType, DerangementType>(
|
||||||
"should return false when comparing two different derangements",
|
"should return false when comparing two different derangements",
|
||||||
false,
|
false,
|
||||||
make_tuple(kDerangementManicDepression, kDerangementParanoia)),
|
make_tuple(kDerangementManicDepression, kDerangementParanoia)),
|
||||||
})
|
})));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_DerangementType_operator_not_equal_to() {
|
TestResults test_DerangementType_operator_not_equal_to() {
|
||||||
return execute_suite<bool, DerangementType, DerangementType>(
|
return execute_suite<bool, DerangementType, DerangementType>(make_test_suite(
|
||||||
make_test_suite(
|
|
||||||
"SBF::DerangementType::operator!=",
|
"SBF::DerangementType::operator!=",
|
||||||
[](const DerangementType& left, const DerangementType& right) {
|
[](const DerangementType& left, const DerangementType& right) { return left != right; },
|
||||||
return left != right;
|
|
||||||
},
|
|
||||||
vector<TestTuple<bool, DerangementType, DerangementType>>({
|
vector<TestTuple<bool, DerangementType, DerangementType>>({
|
||||||
make_test<bool, DerangementType, DerangementType>(
|
make_test<bool, DerangementType, DerangementType>(
|
||||||
"should return false when comparing a derangement to itself",
|
"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>(
|
make_test<bool, DerangementType, DerangementType>(
|
||||||
"should return false when comparing two different instances created with the same values",
|
"should return false when comparing two different instances created with the same values",
|
||||||
false,
|
false,
|
||||||
make_tuple(kDerangementFantasy, DerangementType({kDerangementFantasyId, kDerangementFantasyLabel, kDerangementFantasyDescription, kDerangementFantasyTextColor}))),
|
make_tuple(kDerangementFantasy,
|
||||||
|
DerangementType({kDerangementFantasyId,
|
||||||
|
kDerangementFantasyLabel,
|
||||||
|
kDerangementFantasyDescription,
|
||||||
|
kDerangementFantasyTextColor}))),
|
||||||
make_test<bool, DerangementType, DerangementType>(
|
make_test<bool, DerangementType, DerangementType>(
|
||||||
"should return true when comparing two different derangements",
|
"should return true when comparing two different derangements",
|
||||||
true,
|
true,
|
||||||
make_tuple(kDerangementManicDepression, kDerangementParanoia)),
|
make_tuple(kDerangementManicDepression, kDerangementParanoia)),
|
||||||
})
|
})));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End Test::Derangements
|
} // namespace Test::Derangements
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "Disciplines.h"
|
#include "Disciplines.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|||||||
@@ -103,5 +103,6 @@ namespace SBF {
|
|||||||
/// @param discipline_labels The vector to fill. It will be cleared first.
|
/// @param discipline_labels The vector to fill. It will be cleared first.
|
||||||
void FillDisciplineLabels(std::vector<std::string>& discipline_labels);
|
void FillDisciplineLabels(std::vector<std::string>& discipline_labels);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined DISCIPLINES_H__
|
#endif // End !defined DISCIPLINES_H__
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "Disciplines.h"
|
#include "Disciplines.h"
|
||||||
#include "test.h"
|
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
@@ -13,6 +15,7 @@ namespace Test::Disciplines {
|
|||||||
TestResults test_GetDisciplineLabel();
|
TestResults test_GetDisciplineLabel();
|
||||||
TestResults test_FillDisciplineLabels();
|
TestResults test_FillDisciplineLabels();
|
||||||
} // End namespace Test::Disciplines
|
} // End namespace Test::Disciplines
|
||||||
|
|
||||||
using namespace Test::Disciplines;
|
using namespace Test::Disciplines;
|
||||||
|
|
||||||
TestResults main_test_Disciplines(int argc, char** argv) {
|
TestResults main_test_Disciplines(int argc, char** argv) {
|
||||||
@@ -30,142 +33,47 @@ TestResults test_GetDisciplineLabel() {
|
|||||||
"SBF::GetDisciplineLabel",
|
"SBF::GetDisciplineLabel",
|
||||||
GetDisciplineLabel,
|
GetDisciplineLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for invalid discipline id 0", "", make_tuple(0)),
|
||||||
"should get \"\" for invalid discipline id 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_tuple(0)),
|
make_test<string, int>("should get \"Bardo\" for id 3", "Bardo", make_tuple(3)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Celerity\" for id 4", "Celerity", make_tuple(4)),
|
||||||
"should get \"Animalism\" for id 1",
|
make_test<string, int>("should get \"Chimestry\" for id 5", "Chimestry", make_tuple(5)),
|
||||||
"Animalism",
|
make_test<string, int>("should get \"Dementation\" for id 6", "Dementation", make_tuple(6)),
|
||||||
make_tuple(1)),
|
make_test<string, int>("should get \"Dominate\" for id 7", "Dominate", make_tuple(7)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Fortitude\" for id 8", "Fortitude", make_tuple(8)),
|
||||||
"should get \"Auspex\" for id 2",
|
make_test<string, int>("should get \"Melpominee\" for id 9", "Melpominee", make_tuple(9)),
|
||||||
"Auspex",
|
make_test<string, int>("should get \"Mortis\" for id 10", "Mortis", make_tuple(10)),
|
||||||
make_tuple(2)),
|
make_test<string, int>("should get \"Mytherceria\" for id 11", "Mytherceria", make_tuple(11)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Necromancy\" for id 12", "Necromancy", make_tuple(12)),
|
||||||
"should get \"Bardo\" for id 3",
|
make_test<string, int>("should get \"Obeah\" for id 13", "Obeah", make_tuple(13)),
|
||||||
"Bardo",
|
make_test<string, int>("should get \"Obfuscate\" for id 14", "Obfuscate", make_tuple(14)),
|
||||||
make_tuple(3)),
|
make_test<string, int>("should get \"Obtenebration\" for id 15", "Obtenebration", make_tuple(15)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Potence\" for id 16", "Potence", make_tuple(16)),
|
||||||
"should get \"Celerity\" for id 4",
|
make_test<string, int>("should get \"Presence\" for id 17", "Presence", make_tuple(17)),
|
||||||
"Celerity",
|
make_test<string, int>("should get \"Protean\" for id 18", "Protean", make_tuple(18)),
|
||||||
make_tuple(4)),
|
make_test<string, int>("should get \"Quietus\" for id 19", "Quietus", make_tuple(19)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Serpentis\" for id 20", "Serpentis", make_tuple(20)),
|
||||||
"should get \"Chimestry\" for id 5",
|
make_test<string, int>("should get \"Spiritus\" for id 21", "Spiritus", make_tuple(21)),
|
||||||
"Chimestry",
|
make_test<string, int>("should get \"Thanantosis\" for id 22", "Thanantosis", make_tuple(22)),
|
||||||
make_tuple(5)),
|
make_test<string, int>("should get \"Thaumaturgy\" for id 23", "Thaumaturgy", make_tuple(23)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Vicissitude\" for id 24", "Vicissitude", make_tuple(24)),
|
||||||
"should get \"Dementation\" for id 6",
|
make_test<string, int>("should get \"\" for invalid discipline id 25", "", make_tuple(25)),
|
||||||
"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() {
|
TestResults test_FillDisciplineLabels() {
|
||||||
auto fnToTest = []() -> string {
|
auto fnToTest = []() -> string {
|
||||||
ostringstream error_message;
|
ostringstream error_message;
|
||||||
vector<string> expected = {
|
vector<string> expected = {
|
||||||
kDisciplineAnimalismLabel,
|
kDisciplineAnimalismLabel, kDisciplineAuspexLabel, kDisciplineBardoLabel,
|
||||||
kDisciplineAuspexLabel,
|
kDisciplineCelerityLabel, kDisciplineChimestryLabel, kDisciplineDementationLabel,
|
||||||
kDisciplineBardoLabel,
|
kDisciplineDominateLabel, kDisciplineFortitudeLabel, kDisciplineMelpomineeLabel,
|
||||||
kDisciplineCelerityLabel,
|
kDisciplineMortisLabel, kDisciplineMytherceriaLabel, kDisciplineNecromancyLabel,
|
||||||
kDisciplineChimestryLabel,
|
kDisciplineObeahLabel, kDisciplineObfuscateLabel, kDisciplineObtenebrationLabel,
|
||||||
kDisciplineDementationLabel,
|
kDisciplinePotenceLabel, kDisciplinePresenceLabel, kDisciplineProteanLabel,
|
||||||
kDisciplineDominateLabel,
|
kDisciplineQuietusLabel, kDisciplineSerpentisLabel, kDisciplineSpiritusLabel,
|
||||||
kDisciplineFortitudeLabel,
|
kDisciplineThanantosisLabel, kDisciplineThaumaturgyLabel, kDisciplineVicissitudeLabel,
|
||||||
kDisciplineMelpomineeLabel,
|
|
||||||
kDisciplineMortisLabel,
|
|
||||||
kDisciplineMytherceriaLabel,
|
|
||||||
kDisciplineNecromancyLabel,
|
|
||||||
kDisciplineObeahLabel,
|
|
||||||
kDisciplineObfuscateLabel,
|
|
||||||
kDisciplineObtenebrationLabel,
|
|
||||||
kDisciplinePotenceLabel,
|
|
||||||
kDisciplinePresenceLabel,
|
|
||||||
kDisciplineProteanLabel,
|
|
||||||
kDisciplineQuietusLabel,
|
|
||||||
kDisciplineSerpentisLabel,
|
|
||||||
kDisciplineSpiritusLabel,
|
|
||||||
kDisciplineThanantosisLabel,
|
|
||||||
kDisciplineThaumaturgyLabel,
|
|
||||||
kDisciplineVicissitudeLabel,
|
|
||||||
};
|
};
|
||||||
vector<string> actual = {"This should be removed."};
|
vector<string> actual = {"This should be removed."};
|
||||||
FillDisciplineLabels(actual);
|
FillDisciplineLabels(actual);
|
||||||
@@ -176,15 +84,11 @@ TestResults test_FillDisciplineLabels() {
|
|||||||
}
|
}
|
||||||
return "no errors";
|
return "no errors";
|
||||||
};
|
};
|
||||||
return execute_suite<string>(make_test_suite(
|
return execute_suite<string>(
|
||||||
"SBF::FillDisciplineLabels",
|
make_test_suite("SBF::FillDisciplineLabels",
|
||||||
fnToTest,
|
fnToTest,
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill disciplines", "no errors", make_tuple()),
|
||||||
"should fill disciplines",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
} // End namespace Test::Disciplines
|
} // End namespace Test::Disciplines
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "Genders.h"
|
#include "Genders.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|||||||
@@ -44,5 +44,6 @@ namespace SBF {
|
|||||||
/// @param gender_labels The vector to fill. It will be cleared first.
|
/// @param gender_labels The vector to fill. It will be cleared first.
|
||||||
void FillGenderLabels(std::vector<std::string>& gender_labels);
|
void FillGenderLabels(std::vector<std::string>& gender_labels);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined GENDERS_H__
|
#endif // End !defined GENDERS_H__
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "Genders.h"
|
#include "Genders.h"
|
||||||
#include "test.h"
|
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
@@ -13,6 +15,7 @@ namespace Test::Genders {
|
|||||||
TestResults test_GetGenderLabel();
|
TestResults test_GetGenderLabel();
|
||||||
TestResults test_FillGenderLabels();
|
TestResults test_FillGenderLabels();
|
||||||
} // End namespace Test::Genders
|
} // End namespace Test::Genders
|
||||||
|
|
||||||
using namespace Test::Genders;
|
using namespace Test::Genders;
|
||||||
|
|
||||||
TestResults main_test_Genders(int argc, char** argv) {
|
TestResults main_test_Genders(int argc, char** argv) {
|
||||||
@@ -30,36 +33,14 @@ TestResults test_GetGenderLabel() {
|
|||||||
"SBF::GetGenderLabel",
|
"SBF::GetGenderLabel",
|
||||||
GetGenderLabel,
|
GetGenderLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for invalid gender id 0", "", make_tuple(0)),
|
||||||
"should get \"\" for invalid gender id 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_tuple(0)),
|
make_test<string, int>("should get \"Trans-Male\" for gender id 3", "Trans-Male", make_tuple(3)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"Trans-Female\" for gender id 4", "Trans-Female", make_tuple(4)),
|
||||||
"should get \"Male\" for gender id 1",
|
make_test<string, int>("should get \"Non-Binary\" for gender id 5", "Non-Binary", make_tuple(5)),
|
||||||
"Male",
|
make_test<string, int>("should get \"\" for invalid gender id 6", "", make_tuple(6)),
|
||||||
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() {
|
TestResults test_FillGenderLabels() {
|
||||||
@@ -81,15 +62,10 @@ TestResults test_FillGenderLabels() {
|
|||||||
}
|
}
|
||||||
return "no errors";
|
return "no errors";
|
||||||
};
|
};
|
||||||
return execute_suite<string>(make_test_suite(
|
return execute_suite<string>(make_test_suite("SBF::FillGenderLabels",
|
||||||
"SBF::FillGenderLabels",
|
|
||||||
fnToTest,
|
fnToTest,
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill genders", "no errors", make_tuple()),
|
||||||
"should fill genders",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
} // End namespace Test::Genders
|
} // End namespace Test::Genders
|
||||||
|
|||||||
@@ -114,31 +114,22 @@ Sub PrintMenu (items() As MenuItem, count As Integer, style As MenuStyle)
|
|||||||
If column <> (itemsPerRow - 1) Then
|
If column <> (itemsPerRow - 1) Then
|
||||||
If i <> count Or style.showRandom Then
|
If i <> count Or style.showRandom Then
|
||||||
textLength = Len(itemText$)
|
textLength = Len(itemText$)
|
||||||
itemText$ = MakeFitL$(RTrim$(itemText$) + style.menuItemSpacer, textLength + Len(style.menuItemSpacer), " ")
|
itemText$ = MakeFitL$(RTrim$(itemText$) + style.menuItemSpacer, textLength +
|
||||||
End If
|
Len(style.menuItemSpacer), " ") End If End If Print MakeFitC$(itemText$, columnWidth, " "); End If column = (column + 1)
|
||||||
End If
|
Mod itemsPerRow If column = 0 Then Print "" Next If style.showRandom Then Print
|
||||||
Print MakeFitC$(itemText$, columnWidth, " ");
|
MakeFitC$(GetTitleWithoutValue$(randomItem, style), columnWidth, " ") End If End If End Sub
|
||||||
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)
|
Function GetTitle$ (mi As MenuItem, ms As MenuStyle)
|
||||||
id$ = itos$(mi.id)
|
id$ = itos$(mi.id)
|
||||||
label$ = mi.label
|
label$ = mi.label
|
||||||
If ms.valueWidth > 0 Then label$ = label$ + ms.labelValueSeparator
|
If ms.valueWidth > 0 Then label$ = label$ + ms.labelValueSeparator
|
||||||
value$ = itos$(mi.value)
|
value$ = itos$(mi.value)
|
||||||
GetTitle$ = MakeFitR$(id$, ms.idWidth, " ") + ms.idLabelSeparator + MakeFitL$(label$, ms.labelWidth, " ") + MakeFitR$(value$, ms.valueWidth, " ")
|
GetTitle$ = MakeFitR$(id$, ms.idWidth, " ") + ms.idLabelSeparator + MakeFitL$(label$, ms.labelWidth, " ") +
|
||||||
End Function
|
MakeFitR$(value$, ms.valueWidth, " ") End Function
|
||||||
|
|
||||||
Function GetTitleWithoutValue$ (mi As MenuItem, ms As MenuStyle)
|
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), " ")
|
GetTitleWithoutValue$ = MakeFitR$(itos(mi.id), ms.idWidth, " ") + ms.idLabelSeparator + MakeFitL$(mi.label,
|
||||||
End Function
|
ms.labelWidth + ms.valueWidth + Len(ms.labelValueSeparator), " ") End Function
|
||||||
|
|
||||||
Sub NewMenuStyle (ms As MenuStyle)
|
Sub NewMenuStyle (ms As MenuStyle)
|
||||||
ms.idWidth = 0
|
ms.idWidth = 0
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#ifndef MENUS_H__
|
#ifndef MENUS_H__
|
||||||
#define MENUS_H__
|
#define MENUS_H__
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* @file Menus.h
|
* @file Menus.h
|
||||||
*
|
*
|
||||||
@@ -12,10 +13,11 @@
|
|||||||
namespace SBF {
|
namespace SBF {
|
||||||
struct MenuStyle;
|
struct MenuStyle;
|
||||||
struct MenuItem;
|
struct MenuItem;
|
||||||
}
|
} // namespace SBF
|
||||||
|
|
||||||
// End forward declarations
|
// End forward declarations
|
||||||
#include <string>
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
/** \addtogroup Menus
|
/** \addtogroup Menus
|
||||||
* @{
|
* @{
|
||||||
@@ -59,5 +61,6 @@ namespace SBF {
|
|||||||
void NewMenuItemWithColor(MenuItem& item, string label, int id, uint8_t color);
|
void NewMenuItemWithColor(MenuItem& item, string label, int id, uint8_t color);
|
||||||
|
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // !defined MENUS_H__
|
#endif // !defined MENUS_H__
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
#include "Ranks.h"
|
#include "Ranks.h"
|
||||||
|
|
||||||
|
#include <ostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <ostream>
|
|
||||||
|
|
||||||
namespace SBF {
|
namespace SBF {
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::vector;
|
using std::vector;
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream& os, const RankType& rank) {
|
std::ostream& operator<<(std::ostream& os, const RankType& rank) {
|
||||||
os << "Rank: {id: " << rank.id
|
os << "Rank: {id: " << rank.id << ", label: \"" << rank.label << "\"}";
|
||||||
<< ", label: \"" << rank.label << "\"}";
|
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,5 +67,6 @@ namespace SBF {
|
|||||||
/// @param ranks The vector to fill. It will be cleared first.
|
/// @param ranks The vector to fill. It will be cleared first.
|
||||||
void FillRanks(std::vector<RankType>& ranks);
|
void FillRanks(std::vector<RankType>& ranks);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // !defined RANKS_H__
|
#endif // !defined RANKS_H__
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "Ranks.h"
|
#include "Ranks.h"
|
||||||
#include "test.h"
|
|
||||||
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <sstream>
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
@@ -16,6 +18,7 @@ TestResults test_RankType_operator_not_equal_to();
|
|||||||
TestResults test_GetRank();
|
TestResults test_GetRank();
|
||||||
TestResults test_FillRanks();
|
TestResults test_FillRanks();
|
||||||
} // End namespace Test::Ranks
|
} // End namespace Test::Ranks
|
||||||
|
|
||||||
using namespace Test::Ranks;
|
using namespace Test::Ranks;
|
||||||
|
|
||||||
TestResults main_test_Ranks(int argc, char** argv) {
|
TestResults main_test_Ranks(int argc, char** argv) {
|
||||||
@@ -36,28 +39,15 @@ TestResults test_GetRank() {
|
|||||||
"SBF::GetRank",
|
"SBF::GetRank",
|
||||||
GetRank,
|
GetRank,
|
||||||
vector<TestTuple<RankType, int>>({
|
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>(
|
make_test<RankType, int>(
|
||||||
"should get {0, \"\"} for invalid rank id 0",
|
"should get {1, \"Primary\"} for rank id 1", RankType({1, "Primary"}), make_tuple(1)),
|
||||||
RankType({0, ""}),
|
|
||||||
make_tuple(0)),
|
|
||||||
make_test<RankType, int>(
|
make_test<RankType, int>(
|
||||||
"should get {1, \"Primary\"} for rank id 1",
|
"should get {2, \"Secondary\"} for rank id 2", RankType({2, "Secondary"}), make_tuple(2)),
|
||||||
RankType({1, "Primary"}),
|
|
||||||
make_tuple(1)),
|
|
||||||
make_test<RankType, int>(
|
make_test<RankType, int>(
|
||||||
"should get {2, \"Secondary\"} for rank id 2",
|
"should get {3, \"Tertiary\"} for rank id 3", RankType({3, "Tertiary"}), make_tuple(3)),
|
||||||
RankType({2, "Secondary"}),
|
make_test<RankType, int>("should get {0, \"\"} for invalid rank id 6", RankType({0, ""}), make_tuple(6)),
|
||||||
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)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_FillRanks() {
|
TestResults test_FillRanks() {
|
||||||
@@ -77,16 +67,11 @@ TestResults test_FillRanks() {
|
|||||||
}
|
}
|
||||||
return "no errors";
|
return "no errors";
|
||||||
};
|
};
|
||||||
return execute_suite<string>(make_test_suite(
|
return execute_suite<string>(make_test_suite("SBF::FillRanks",
|
||||||
"SBF::FillRanks",
|
|
||||||
fnToTest,
|
fnToTest,
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill ranks", "no errors", make_tuple()),
|
||||||
"should fill ranks",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_RankType_operator_extract() {
|
TestResults test_RankType_operator_extract() {
|
||||||
@@ -100,68 +85,47 @@ TestResults test_RankType_operator_extract() {
|
|||||||
fnToTest,
|
fnToTest,
|
||||||
vector<TestTuple<string, RankType>>({
|
vector<TestTuple<string, RankType>>({
|
||||||
make_test<string, RankType>(
|
make_test<string, RankType>(
|
||||||
"should print an invalid rank",
|
"should print an invalid rank", "Rank: {id: 0, label: \"\"}", make_tuple((RankType){0, ""})),
|
||||||
"Rank: {id: 0, label: \"\"}",
|
|
||||||
make_tuple((RankType){0, ""})),
|
|
||||||
make_test<string, RankType>(
|
make_test<string, RankType>(
|
||||||
"should print primary",
|
"should print primary", "Rank: {id: 1, label: \"Primary\"}", make_tuple(kRankPrimary)),
|
||||||
"Rank: {id: 1, label: \"Primary\"}",
|
|
||||||
make_tuple(kRankPrimary)),
|
|
||||||
make_test<string, RankType>(
|
make_test<string, RankType>(
|
||||||
"should print secondary",
|
"should print secondary", "Rank: {id: 2, label: \"Secondary\"}", make_tuple(kRankSecondary)),
|
||||||
"Rank: {id: 2, label: \"Secondary\"}",
|
|
||||||
make_tuple(kRankSecondary)),
|
|
||||||
make_test<string, RankType>(
|
make_test<string, RankType>(
|
||||||
"should print tertiary",
|
"should print tertiary", "Rank: {id: 3, label: \"Tertiary\"}", make_tuple(kRankTertiary)),
|
||||||
"Rank: {id: 3, label: \"Tertiary\"}",
|
})));
|
||||||
make_tuple(kRankTertiary)),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_RankType_operator_equal_to() {
|
TestResults test_RankType_operator_equal_to() {
|
||||||
return execute_suite<bool, RankType, RankType>(make_test_suite(
|
return execute_suite<bool, RankType, RankType>(make_test_suite(
|
||||||
"SBF::RankType::operator==",
|
"SBF::RankType::operator==",
|
||||||
[](const RankType& left, const RankType& right) {
|
[](const RankType& left, const RankType& right) { return left == right; },
|
||||||
return left == right;
|
|
||||||
},
|
|
||||||
vector<TestTuple<bool, RankType, RankType>>({
|
vector<TestTuple<bool, RankType, RankType>>({
|
||||||
make_test<bool, RankType, RankType>(
|
make_test<bool, RankType, RankType>(
|
||||||
"should return true when comparing an rank to itself",
|
"should return true when comparing an rank to itself", true, make_tuple(kRankPrimary, kRankPrimary)),
|
||||||
true,
|
|
||||||
make_tuple(kRankPrimary, kRankPrimary)),
|
|
||||||
make_test<bool, RankType, RankType>(
|
make_test<bool, RankType, RankType>(
|
||||||
"should return true when comparing two different instances created with the same values",
|
"should return true when comparing two different instances created with the same values",
|
||||||
true,
|
true,
|
||||||
make_tuple(kRankSecondary, RankType({kRankSecondaryId, kRankSecondaryLabel}))),
|
make_tuple(kRankSecondary, RankType({kRankSecondaryId, kRankSecondaryLabel}))),
|
||||||
make_test<bool, RankType, RankType>(
|
make_test<bool, RankType, RankType>("should return false when comparing two different rank gropus",
|
||||||
"should return false when comparing two different rank gropus",
|
|
||||||
false,
|
false,
|
||||||
make_tuple(kRankPrimary, kRankTertiary)),
|
make_tuple(kRankPrimary, kRankTertiary)),
|
||||||
})
|
})));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_RankType_operator_not_equal_to() {
|
TestResults test_RankType_operator_not_equal_to() {
|
||||||
return execute_suite<bool, RankType, RankType>(make_test_suite(
|
return execute_suite<bool, RankType, RankType>(make_test_suite(
|
||||||
"SBF::RankType::operator!=",
|
"SBF::RankType::operator!=",
|
||||||
[](const RankType& left, const RankType& right) {
|
[](const RankType& left, const RankType& right) { return left != right; },
|
||||||
return left != right;
|
|
||||||
},
|
|
||||||
vector<TestTuple<bool, RankType, RankType>>({
|
vector<TestTuple<bool, RankType, RankType>>({
|
||||||
make_test<bool, RankType, RankType>(
|
make_test<bool, RankType, RankType>(
|
||||||
"should return false when comparing an rank to itself",
|
"should return false when comparing an rank to itself", false, make_tuple(kRankPrimary, kRankPrimary)),
|
||||||
false,
|
|
||||||
make_tuple(kRankPrimary, kRankPrimary)),
|
|
||||||
make_test<bool, RankType, RankType>(
|
make_test<bool, RankType, RankType>(
|
||||||
"should return false when comparing two different instances created with the same values",
|
"should return false when comparing two different instances created with the same values",
|
||||||
false,
|
false,
|
||||||
make_tuple(kRankSecondary, RankType({kRankSecondaryId, kRankSecondaryLabel}))),
|
make_tuple(kRankSecondary, RankType({kRankSecondaryId, kRankSecondaryLabel}))),
|
||||||
make_test<bool, RankType, RankType>(
|
make_test<bool, RankType, RankType>("should return true when comparing two different rank gropus",
|
||||||
"should return true when comparing two different rank gropus",
|
|
||||||
true,
|
true,
|
||||||
make_tuple(kRankSecondary, kRankTertiary)),
|
make_tuple(kRankSecondary, kRankTertiary)),
|
||||||
})
|
})));
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} // namespace Test::Ranks
|
||||||
|
|||||||
@@ -1,25 +1,19 @@
|
|||||||
#define _XOPEN_SOURCE_EXTENDED
|
#define _XOPEN_SOURCE_EXTENDED
|
||||||
#include <iostream>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <string>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <vector>
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
|
|
||||||
namespace SBF {
|
namespace SBF {
|
||||||
using std::cout;
|
|
||||||
using std::tuple;
|
|
||||||
using std::wcerr;
|
|
||||||
using std::string;
|
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 word_wrap(const string& text, const size_t max_width) {
|
||||||
string output = "";
|
string output = "";
|
||||||
|
|||||||
@@ -55,5 +55,6 @@ namespace SBF {
|
|||||||
/// @return The repeated string.
|
/// @return The repeated string.
|
||||||
string string_dollar(const size_t length, const char ch);
|
string string_dollar(const size_t length, const char ch);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined UTILS_H__
|
#endif // End !defined UTILS_H__
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "test.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -16,6 +18,7 @@ TestResults test_make_fit_l();
|
|||||||
TestResults test_string_dollar();
|
TestResults test_string_dollar();
|
||||||
TestResults test_word_wrap();
|
TestResults test_word_wrap();
|
||||||
} // End namespace Test::Utils
|
} // End namespace Test::Utils
|
||||||
|
|
||||||
using namespace Test::Utils;
|
using namespace Test::Utils;
|
||||||
|
|
||||||
TestResults main_test_Utils(int argc, char** argv) {
|
TestResults main_test_Utils(int argc, char** argv) {
|
||||||
@@ -33,17 +36,20 @@ TestResults main_test_Utils(int argc, char** argv) {
|
|||||||
|
|
||||||
namespace Test::Utils {
|
namespace Test::Utils {
|
||||||
TestResults test_get_index_of() {
|
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(
|
return execute_suite<size_t, string, string, size_t>(make_test_suite(
|
||||||
"SBF::get_index_of",
|
"SBF::get_index_of",
|
||||||
get_index_of,
|
get_index_of,
|
||||||
vector<TestTuple<size_t, string, string, size_t>>({
|
vector<TestTuple<size_t, string, string, size_t>>({
|
||||||
make_test<size_t, string, string, size_t>(
|
make_test<size_t, string, string, size_t>(
|
||||||
"should get 0 for the first word in a string",
|
"should get 0 for the first word in a string", 0, make_tuple(long_text, string("Lorem"), size_t(0))),
|
||||||
0,
|
make_test<size_t, string, string, size_t>("should get the location of a word in the larger string",
|
||||||
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,
|
22,
|
||||||
make_tuple(long_text, string("dummy"), size_t(0))),
|
make_tuple(long_text, string("dummy"), size_t(0))),
|
||||||
make_test<size_t, string, string, size_t>(
|
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",
|
"should get -1 for the location of a word that is before start location in the string",
|
||||||
-1,
|
-1,
|
||||||
make_tuple(long_text, string("dummy"), size_t(long_text.size()))),
|
make_tuple(long_text, string("dummy"), size_t(long_text.size()))),
|
||||||
make_test<size_t, string, string, size_t>(
|
make_test<size_t, string, string, size_t>("should get the location of a word within a simple string",
|
||||||
"should get the location of a word within a simple string",
|
|
||||||
6,
|
6,
|
||||||
make_tuple(string("these are words"), string("are"), size_t(0))),
|
make_tuple(string("these are words"), string("are"), size_t(0))),
|
||||||
make_test<size_t, string, string, size_t>(
|
make_test<size_t, string, string, size_t>("should get the first location of a word within the string",
|
||||||
"should get the first location of a word within the string",
|
|
||||||
4,
|
4,
|
||||||
make_tuple(string("one two one two"), string("two"), size_t(0))),
|
make_tuple(string("one two one two"), string("two"), size_t(0))),
|
||||||
make_test<size_t, string, string, size_t>(
|
make_test<size_t, string, string, size_t>("should get the second location of a word within the string",
|
||||||
"should get the second location of a word within the string",
|
|
||||||
12,
|
12,
|
||||||
make_tuple(string("one two one two"), string("two"), size_t(5))),
|
make_tuple(string("one two one two"), string("two"), size_t(5))),
|
||||||
})
|
})));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_get_substring() {
|
TestResults test_get_substring() {
|
||||||
@@ -80,35 +82,21 @@ TestResults test_get_substring() {
|
|||||||
get_substring,
|
get_substring,
|
||||||
vector<TestTuple<string, string, size_t, size_t>>({
|
vector<TestTuple<string, string, size_t, size_t>>({
|
||||||
make_test<string, string, size_t, size_t>(
|
make_test<string, string, size_t, size_t>(
|
||||||
"should get an empty string if start is too big",
|
"should get an empty string if start is too big", "", make_tuple(string("asdf"), size_t(6), size_t(2))),
|
||||||
"",
|
|
||||||
make_tuple(string("asdf"), size_t(6), size_t(2))),
|
|
||||||
make_test<string, string, size_t, size_t>(
|
make_test<string, string, size_t, size_t>(
|
||||||
"should get an empty string if count is 0",
|
"should get an empty string if count is 0", "", make_tuple(string("asdf"), size_t(0), size_t(0))),
|
||||||
"",
|
|
||||||
make_tuple(string("asdf"), size_t(0), size_t(0))),
|
|
||||||
make_test<string, string, size_t, size_t>(
|
make_test<string, string, size_t, size_t>(
|
||||||
"should get a string that starts at 0",
|
"should get a string that starts at 0", "as", make_tuple(string("asdf"), size_t(0), size_t(2))),
|
||||||
"as",
|
|
||||||
make_tuple(string("asdf"), size_t(0), size_t(2))),
|
|
||||||
make_test<string, string, size_t, size_t>(
|
make_test<string, string, size_t, size_t>(
|
||||||
"should get the whole string",
|
"should get the whole string", "asdf", make_tuple(string("asdf"), size_t(0), size_t(4))),
|
||||||
"asdf",
|
make_test<string, string, size_t, size_t>("should get a partial string if count is too big",
|
||||||
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",
|
"asdf",
|
||||||
make_tuple(string("asdf"), size_t(0), size_t(8))),
|
make_tuple(string("asdf"), size_t(0), size_t(8))),
|
||||||
make_test<string, string, size_t, size_t>(
|
make_test<string, string, size_t, size_t>(
|
||||||
"should get a substring",
|
"should get a substring", "234", make_tuple(string("1234567890"), size_t(1), size_t(3))),
|
||||||
"234",
|
|
||||||
make_tuple(string("1234567890"), size_t(1), size_t(3))),
|
|
||||||
make_test<string, string, size_t, size_t>(
|
make_test<string, string, size_t, size_t>(
|
||||||
"should get a word",
|
"should get a word", "Paris", make_tuple(string("Where is Paris?"), size_t(9), size_t(5))),
|
||||||
"Paris",
|
})));
|
||||||
make_tuple(string("Where is Paris?"), size_t(9), size_t(5))),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_left() {
|
TestResults test_left() {
|
||||||
@@ -117,27 +105,18 @@ TestResults test_left() {
|
|||||||
SBF::left,
|
SBF::left,
|
||||||
vector<TestTuple<string, string, size_t>>({
|
vector<TestTuple<string, string, size_t>>({
|
||||||
make_test<string, string, size_t>(
|
make_test<string, string, size_t>(
|
||||||
"should get a substring",
|
"should get a substring", "Micro", make_tuple(string("Microsoft QBasic"), size_t(5))),
|
||||||
"Micro",
|
make_test<string, string, size_t>("should get the whole string if length is equal to text.size()",
|
||||||
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",
|
"Microsoft QBasic",
|
||||||
make_tuple(string("Microsoft QBasic"), size_t(16))),
|
make_tuple(string("Microsoft QBasic"), size_t(16))),
|
||||||
make_test<string, string, size_t>(
|
make_test<string, string, size_t>("should get the whole string if length is greater than text.size()",
|
||||||
"should get the whole string if length is greater than text.size()",
|
|
||||||
"Microsoft QBasic",
|
"Microsoft QBasic",
|
||||||
make_tuple(string("Microsoft QBasic"), size_t(20))),
|
make_tuple(string("Microsoft QBasic"), size_t(20))),
|
||||||
make_test<string, string, size_t>(
|
make_test<string, string, size_t>(
|
||||||
"should get an empty string if length is 0",
|
"should get an empty string if length is 0", "", make_tuple(string("Microsoft QBasic"), size_t(0))),
|
||||||
"",
|
|
||||||
make_tuple(string("Microsoft QBasic"), size_t(0))),
|
|
||||||
make_test<string, string, size_t>(
|
make_test<string, string, size_t>(
|
||||||
"should get an empty string if text is empty",
|
"should get an empty string if text is empty", "", make_tuple(string(""), size_t(1))),
|
||||||
"",
|
})));
|
||||||
make_tuple(string(""), size_t(1))),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_make_fit_l() {
|
TestResults test_make_fit_l() {
|
||||||
@@ -146,27 +125,17 @@ TestResults test_make_fit_l() {
|
|||||||
make_fit_l,
|
make_fit_l,
|
||||||
vector<TestTuple<string, string, int32_t, char>>({
|
vector<TestTuple<string, string, int32_t, char>>({
|
||||||
make_test<string, string, int32_t, char>(
|
make_test<string, string, int32_t, char>(
|
||||||
"should truncate a string that is too long",
|
"should truncate a string that is too long", "Micro", make_tuple(string("Microsoft QBasic"), 5, 'A')),
|
||||||
"Micro",
|
|
||||||
make_tuple(string("Microsoft QBasic"), 5, 'A')),
|
|
||||||
make_test<string, string, int32_t, char>(
|
make_test<string, string, int32_t, char>(
|
||||||
"should pad a string that is too short",
|
"should pad a string that is too short", "MicroAAAAA", make_tuple(string("Micro"), 10, 'A')),
|
||||||
"MicroAAAAA",
|
|
||||||
make_tuple(string("Micro"), 10, 'A')),
|
|
||||||
make_test<string, string, int32_t, char>(
|
make_test<string, string, int32_t, char>(
|
||||||
"should return a string that is perfectly sized",
|
"should return a string that is perfectly sized", "Micro", make_tuple(string("Micro"), 5, 'A')),
|
||||||
"Micro",
|
make_test<string, string, int32_t, char>("should pad the string with spaces if padCh is the null character",
|
||||||
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 ",
|
"Micro ",
|
||||||
make_tuple(string("Micro"), 10, '\0')),
|
make_tuple(string("Micro"), 10, '\0')),
|
||||||
make_test<string, string, int32_t, char>(
|
make_test<string, string, int32_t, char>(
|
||||||
"should return a padded string even if text is empty",
|
"should return a padded string even if text is empty", "ZZZZZZZZZZ", make_tuple(string(""), 10, 'Z')),
|
||||||
"ZZZZZZZZZZ",
|
})));
|
||||||
make_tuple(string(""), 10, 'Z')),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TestResults test_string_dollar() {
|
TestResults test_string_dollar() {
|
||||||
@@ -174,21 +143,13 @@ TestResults test_string_dollar() {
|
|||||||
"SBF::string_dollar",
|
"SBF::string_dollar",
|
||||||
string_dollar,
|
string_dollar,
|
||||||
vector<TestTuple<string, size_t, char>>({
|
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>(
|
make_test<string, size_t, char>(
|
||||||
"should make a string",
|
"should make a string of spaces if ch is the null character", " ", make_tuple(size_t(5), '\0')),
|
||||||
"YYYYY",
|
make_test<string, size_t, char>("should make an empty string if length is 0", "", make_tuple(size_t(0), 'C')),
|
||||||
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')),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// string word_wrap(const string& text, int maxWidth);
|
// string word_wrap(const string& text, int maxWidth);
|
||||||
TestResults test_word_wrap() {
|
TestResults test_word_wrap() {
|
||||||
return execute_suite<string, string, int32_t>(make_test_suite(
|
return execute_suite<string, string, int32_t>(make_test_suite(
|
||||||
@@ -196,31 +157,22 @@ TestResults test_word_wrap() {
|
|||||||
word_wrap,
|
word_wrap,
|
||||||
vector<TestTuple<string, string, int32_t>>({
|
vector<TestTuple<string, string, int32_t>>({
|
||||||
make_test<string, string, int32_t>(
|
make_test<string, string, int32_t>(
|
||||||
"should return the string if it is shorter than max_width",
|
"should return the string if it is shorter than max_width", "0123_", make_tuple(string("0123"), 5)),
|
||||||
"0123_",
|
|
||||||
make_tuple(string("0123"), 5)),
|
|
||||||
make_test<string, string, int32_t>(
|
make_test<string, string, int32_t>(
|
||||||
"should return the string if its length is equal to max_width",
|
"should return the string if its length is equal to max_width", "01234", make_tuple(string("01234"), 5)),
|
||||||
"01234",
|
make_test<string, string, int32_t>("should wrap a string to two lines if it has no whitespace",
|
||||||
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____",
|
"01234\n5____",
|
||||||
make_tuple(string("012345"), 5)),
|
make_tuple(string("012345"), 5)),
|
||||||
make_test<string, string, int32_t>(
|
make_test<string, string, int32_t>("should wrap a string to three lines if it has no whitespace",
|
||||||
"should wrap a string to three lines if it has no whitespace",
|
|
||||||
"01234\n56789\n0____",
|
"01234\n56789\n0____",
|
||||||
make_tuple(string("01234567890"), 5)),
|
make_tuple(string("01234567890"), 5)),
|
||||||
make_test<string, string, int32_t>(
|
make_test<string, string, int32_t>("should wrap a string with even spacing",
|
||||||
"should wrap a string with even spacing",
|
|
||||||
"01 23\n45 67\n89 01",
|
"01 23\n45 67\n89 01",
|
||||||
make_tuple(string("01 23 45 67 89 01"), 5)),
|
make_tuple(string("01 23 45 67 89 01"), 5)),
|
||||||
make_test<string, string, int32_t>(
|
make_test<string, string, int32_t>("should collapse whitespace to a single space",
|
||||||
"should collapse whitespace to a single space",
|
|
||||||
"01 34\n67 90\n23 56\n89___",
|
"01 34\n67 90\n23 56\n89___",
|
||||||
make_tuple(string("01 34 67 90 23 56 89 "), 5)),
|
make_tuple(string("01 34 67 90 23 56 89 "), 5)),
|
||||||
// TODO: Treat newlines and tabs in text as spaces.
|
// TODO: Treat newlines and tabs in text as spaces.
|
||||||
})
|
})));
|
||||||
));
|
|
||||||
}
|
}
|
||||||
} // End namespace Test::Utils
|
} // End namespace Test::Utils
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "Virtues.h"
|
#include "Virtues.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -10,6 +11,7 @@ const std::string GetVirtueLabel(int id) {
|
|||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillVirtueLabels(std::vector<std::string>& labels) {
|
void FillVirtueLabels(std::vector<std::string>& labels) {
|
||||||
labels.clear();
|
labels.clear();
|
||||||
for (int id = 1; id <= kVirtuesCount; id++) {
|
for (int id = 1; id <= kVirtuesCount; id++) {
|
||||||
|
|||||||
@@ -40,5 +40,6 @@ namespace SBF {
|
|||||||
/// @param virtue_labels The vector to fill. It will be cleared first.
|
/// @param virtue_labels The vector to fill. It will be cleared first.
|
||||||
void FillVirtueLabels(std::vector<std::string>& virtue_labels);
|
void FillVirtueLabels(std::vector<std::string>& virtue_labels);
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif // End !defined VIRTUES_H__
|
#endif // End !defined VIRTUES_H__
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#include "Virtues.h"
|
#include "Virtues.h"
|
||||||
#include "test.h"
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
|
||||||
#include <tuple>
|
#include <tuple>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "test.h"
|
||||||
|
|
||||||
using namespace SBF;
|
using namespace SBF;
|
||||||
using namespace Test;
|
using namespace Test;
|
||||||
@@ -12,6 +14,7 @@ namespace Test::Virtues {
|
|||||||
TestResults test_GetVirtueLabel();
|
TestResults test_GetVirtueLabel();
|
||||||
TestResults test_FillVirtueLabels();
|
TestResults test_FillVirtueLabels();
|
||||||
} // End namespace Test::Virtues
|
} // End namespace Test::Virtues
|
||||||
|
|
||||||
using namespace Test::Virtues;
|
using namespace Test::Virtues;
|
||||||
|
|
||||||
TestResults main_test_Virtues(int argc, char** argv) {
|
TestResults main_test_Virtues(int argc, char** argv) {
|
||||||
@@ -29,28 +32,12 @@ TestResults test_GetVirtueLabel() {
|
|||||||
"SBF::GetVirtueLabel",
|
"SBF::GetVirtueLabel",
|
||||||
GetVirtueLabel,
|
GetVirtueLabel,
|
||||||
vector<TestTuple<string, int>>({
|
vector<TestTuple<string, int>>({
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for invalid virtue id 0", "", make_tuple(0)),
|
||||||
"should get \"\" for invalid virtue id 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_tuple(0)),
|
make_test<string, int>("should get \"Conscience\" for virtue id 3", "Conscience", make_tuple(3)),
|
||||||
make_test<string, int>(
|
make_test<string, int>("should get \"\" for invalid virtue id 4", "", make_tuple(4)),
|
||||||
"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() {
|
TestResults test_FillVirtueLabels() {
|
||||||
@@ -70,16 +57,11 @@ TestResults test_FillVirtueLabels() {
|
|||||||
}
|
}
|
||||||
return "no errors";
|
return "no errors";
|
||||||
};
|
};
|
||||||
return execute_suite<string>(make_test_suite(
|
return execute_suite<string>(make_test_suite("SBF::FillVirtueLabels",
|
||||||
"SBF::FillVirtueLabels",
|
|
||||||
fnToTest,
|
fnToTest,
|
||||||
vector<TestTuple<string>>({
|
vector<TestTuple<string>>({
|
||||||
make_test<string>(
|
make_test<string>("should fill ranks", "no errors", make_tuple()),
|
||||||
"should fill ranks",
|
})));
|
||||||
"no errors",
|
|
||||||
make_tuple()),
|
|
||||||
})
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // End namespace Test::Virtues
|
} // End namespace Test::Virtues
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
#define _XOPEN_SOURCE_EXTENDED
|
#define _XOPEN_SOURCE_EXTENDED
|
||||||
#include <ncursesw/curses.h>
|
#include <ncursesw/curses.h>
|
||||||
#include <iostream>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define KEY_ESCAPE 0033
|
#define KEY_ESCAPE 0033
|
||||||
@@ -58,18 +59,18 @@ int main(int argc, char* argv[]) {
|
|||||||
// Draw a box around the window with default chars.
|
// Draw a box around the window with default chars.
|
||||||
set_double_border(pWindow);
|
set_double_border(pWindow);
|
||||||
// Display the event
|
// Display the event
|
||||||
mvwaddwstr(pWindow, 2, 2, "Resized");
|
mvwaddstr(pWindow, 2, 2, "Resized");
|
||||||
// Get the window width and height.
|
// Get the window width and height.
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
getmaxyx(pWindow, height, width);
|
getmaxyx(pWindow, height, width);
|
||||||
// Display the width and height.
|
// Display the width and height.
|
||||||
swprintf(buffer, sizeof(buffer), "width: %i, height: %i", width, height);
|
snprintf(buffer, sizeof(buffer), "width: %i, height: %i", width, height);
|
||||||
mvwaddwstr(pWindow, 1, 2, buffer);
|
mvwaddstr(pWindow, 1, 2, buffer);
|
||||||
} else {
|
} else {
|
||||||
// Display the keycode of the key that was pressed in hex and octal.
|
// Display the keycode of the key that was pressed in hex and octal.
|
||||||
swprintf(buffer, sizeof(buffer), "0x%04X %04o pressed", key, key);
|
snprintf(buffer, sizeof(buffer), "0x%04X %04o pressed", key, key);
|
||||||
mvwaddwstr(pWindow,2, 2, buffer);
|
mvwaddstr(pWindow, 2, 2, buffer);
|
||||||
}
|
}
|
||||||
wrefresh(pWindow);
|
wrefresh(pWindow);
|
||||||
key = wgetch(pWindow);
|
key = wgetch(pWindow);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#ifndef MAIN_H__
|
#ifndef MAIN_H__
|
||||||
#define MAIN_H__
|
#define MAIN_H__
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
* @file main.h
|
* @file main.h
|
||||||
*
|
*
|
||||||
@@ -12,8 +13,7 @@
|
|||||||
/** \addtogroup Unsorted
|
/** \addtogroup Unsorted
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
namespace SBF {
|
namespace SBF {}
|
||||||
|
|
||||||
}
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
#endif
|
#endif
|
||||||
@@ -1,8 +1,10 @@
|
|||||||
#define _XOPEN_SOURCE_EXTENDED
|
#define _XOPEN_SOURCE_EXTENDED
|
||||||
#include "sbf.h"
|
#include "sbf.h"
|
||||||
|
|
||||||
#include <ncursesw/curses.h>
|
#include <ncursesw/curses.h>
|
||||||
#include <iostream>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#define KEY_ESCAPE 0033
|
#define KEY_ESCAPE 0033
|
||||||
|
|||||||
311
sbf-cpp/sbf.h
311
sbf-cpp/sbf.h
@@ -8,10 +8,11 @@
|
|||||||
* Copyright 2023 Tom Hicks
|
* Copyright 2023 Tom Hicks
|
||||||
* Licensed under the MIT license see the LICENSE file for details.
|
* Licensed under the MIT license see the LICENSE file for details.
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
#include "Character.h"
|
||||||
#include "Colors.h"
|
#include "Colors.h"
|
||||||
#include "Menus.h"
|
#include "Menus.h"
|
||||||
#include "Character.h"
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
/** \addtogroup Unsorted
|
/** \addtogroup Unsorted
|
||||||
* @{
|
* @{
|
||||||
@@ -21,10 +22,6 @@ namespace SBF {
|
|||||||
|
|
||||||
const int kInitialGeneration = 13;
|
const int kInitialGeneration = 13;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
$Debug
|
$Debug
|
||||||
@@ -86,29 +83,29 @@ Sub MainMenu
|
|||||||
choice = 0
|
choice = 0
|
||||||
Do
|
Do
|
||||||
Cls
|
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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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> What are you going to do? <20>"
|
||||||
Print "<22> 1 = Character Generator <20>"
|
Print "<22> 1 = Character Generator <20>"
|
||||||
Print "<22> 2 = Character Generator for Dummies <20>"
|
Print "<22> 2 = Character Generator for Dummies <20>"
|
||||||
Print "<22> 3 = Combat Computer <20>"
|
Print "<22> 3 = Combat Computer <20>"
|
||||||
Print "<22> 4 = Dice Roller <20>"
|
Print "<22> 4 = Dice Roller <20>"
|
||||||
Print "<22> 5 = Random Character Generator <20>"
|
Print "<22> 5 = Random Character Generator <20>"
|
||||||
Print "<22> 6 = <20>"
|
Print "<22> 6 = <20>"
|
||||||
Print "<22> 7 = Vehicle Generator <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> <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> 0 = End <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>ͼ"
|
||||||
choice = GetChoice(0, 7)
|
choice = GetChoice(0, 7)
|
||||||
Select Case choice
|
Select Case choice
|
||||||
Case 1
|
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.
|
' This sub is not called. It is here so it can be copied whenever I need to make a new bordered screen.
|
||||||
Sub BlankScreen
|
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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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> <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>ͼ"
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Function GetChoice (min As Integer, max As Integer)
|
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
|
ChooseStringId = choice
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Function ChooseStringIdWithValues (labels() As String, values() As Integer, style As MenuStyle, count As Integer, prompt As String)
|
Function ChooseStringIdWithValues (labels() As String, values() As Integer, style As MenuStyle, count As Integer, prompt
|
||||||
Cls
|
As String) Cls Dim mnuItems(1 To count) As MenuItem Call BuildMenuWithValues(mnuItems(), labels(), values(), count) Call
|
||||||
Dim mnuItems(1 To count) As MenuItem
|
AdjustMenuStyle(style, mnuItems(), count, FALSE) Print prompt Call PrintMenu(mnuItems(), count, style) choice =
|
||||||
Call BuildMenuWithValues(mnuItems(), labels(), values(), count)
|
GetMenuChoice(mnuItems(), style, count) If choice = style.randomItemId Then choice = GetRandomMenuItemId(mnuItems(),
|
||||||
Call AdjustMenuStyle(style, mnuItems(), count, FALSE)
|
count) ChooseStringIdWithValues = choice End Function
|
||||||
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)
|
Function ChooseStringIdWithColors (labels() As String, colors() As Integer, style As MenuStyle, prompt As String)
|
||||||
Cls
|
Cls
|
||||||
@@ -234,11 +225,8 @@ Function ChooseStringIdWithColors (labels() As String, colors() As Integer, styl
|
|||||||
ChooseStringIdWithColors = choice
|
ChooseStringIdWithColors = choice
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Function ChooseMenuItemId (items() As MenuItem, style As MenuStyle, count As Integer, prompt As String, ignoreValue As Integer)
|
Function ChooseMenuItemId (items() As MenuItem, style As MenuStyle, count As Integer, prompt As String, ignoreValue As
|
||||||
Cls
|
Integer) Cls Call AdjustMenuStyle(style, items(), count, ignoreValue) Print prompt Call PrintMenu(items(), count, style)
|
||||||
Call AdjustMenuStyle(style, items(), count, ignoreValue)
|
|
||||||
Print prompt
|
|
||||||
Call PrintMenu(items(), count, style)
|
|
||||||
choice = GetMenuChoice(items(), style, count)
|
choice = GetMenuChoice(items(), style, count)
|
||||||
If choice = style.randomItemId Then choice = GetRandomMenuItemId(items(), count)
|
If choice = style.randomItemId Then choice = GetRandomMenuItemId(items(), count)
|
||||||
ChooseMenuItemId = choice
|
ChooseMenuItemId = choice
|
||||||
@@ -269,11 +257,9 @@ Sub CGGetDisciplines (ch As CharacterType)
|
|||||||
While disciplinePoints > 0
|
While disciplinePoints > 0
|
||||||
Cls
|
Cls
|
||||||
Call FillDisciplines(ch, disciplineValues())
|
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?")
|
discipline = ChooseStringIdWithValues(Disciplines(), disciplineValues(), ms, DISCIPLINES_COUNT, "Which
|
||||||
Call SetDiscipline(ch, discipline, GetDiscipline(ch, discipline) + 1)
|
discipline do you want to spend 1 of your " + itos$(disciplinePoints) + " points on?") Call SetDiscipline(ch,
|
||||||
disciplinePoints = disciplinePoints - 1
|
discipline, GetDiscipline(ch, discipline) + 1) disciplinePoints = disciplinePoints - 1 Wend End Sub
|
||||||
Wend
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub CGGetAttributes (ch As CharacterType)
|
Sub CGGetAttributes (ch As CharacterType)
|
||||||
Dim msWithoutValues As MenuStyle
|
Dim msWithoutValues As MenuStyle
|
||||||
@@ -294,16 +280,11 @@ Sub CGGetAttributes (ch As CharacterType)
|
|||||||
groupSum = 0
|
groupSum = 0
|
||||||
rankSum = 1
|
rankSum = 1
|
||||||
For i = 1 To ATTRIBUTE_GROUPS_COUNT - 1
|
For i = 1 To ATTRIBUTE_GROUPS_COUNT - 1
|
||||||
nextGroup = ChooseMenuItemId(mnuAttributeGroups(), msWithoutValues, ATTRIBUTE_GROUPS_COUNT, "Choose your " + LCase$(Ranks(i).label) + " attribute?", TRUE)
|
nextGroup = ChooseMenuItemId(mnuAttributeGroups(), msWithoutValues, ATTRIBUTE_GROUPS_COUNT, "Choose your " +
|
||||||
mnuAttributeGroups(nextGroup).isVisible = FALSE
|
LCase$(Ranks(i).label) + " attribute?", TRUE) mnuAttributeGroups(nextGroup).isVisible = FALSE attributeRanks(nextGroup)
|
||||||
attributeRanks(nextGroup) = i
|
= i rankSum = rankSum + i + 1 groupSum = groupSum + nextGroup Next ' General formula for last choice given 1 to count
|
||||||
rankSum = rankSum + i + 1
|
based indexing is this ' (Sum from 1 to count) - (Sum of all previous choice IDs) '
|
||||||
groupSum = groupSum + nextGroup
|
Sum(1..AllAttributesCount)-Sum(Choice[1]..Choice[AllAttributesCount-1]) lastGroup = rankSum - groupSum
|
||||||
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
|
attributeRanks(lastGroup) = ATTRIBUTE_GROUPS_COUNT
|
||||||
|
|
||||||
' Spend attribute points
|
' Spend attribute points
|
||||||
@@ -315,11 +296,9 @@ Sub CGGetAttributes (ch As CharacterType)
|
|||||||
ReDim values(1 To count) As Integer
|
ReDim values(1 To count) As Integer
|
||||||
For attrPoints = GetAttributePointsForRank(rank) To 1 Step -1
|
For attrPoints = GetAttributePointsForRank(rank) To 1 Step -1
|
||||||
Call FillAttributeValues(ch, values(), group)
|
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?")
|
attribute = ChooseStringIdWithValues(attributes(), values(), msWithValues, count, "Which " +
|
||||||
Call SetAttributeValue(ch, group, attribute, GetAttributeValue(ch, group, attribute) + 1)
|
LCase$(AttributeGroups(group)) + " attribute do you want to spend 1 of your " + itos$(attrPoints) + " points on?") Call
|
||||||
Next
|
SetAttributeValue(ch, group, attribute, GetAttributeValue(ch, group, attribute) + 1) Next Next End Sub
|
||||||
Next
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub CGGetAbilities (ch As CharacterType)
|
Sub CGGetAbilities (ch As CharacterType)
|
||||||
Dim msWithoutValues As MenuStyle
|
Dim msWithoutValues As MenuStyle
|
||||||
@@ -340,16 +319,11 @@ Sub CGGetAbilities (ch As CharacterType)
|
|||||||
groupSum = 0
|
groupSum = 0
|
||||||
rankSum = 1
|
rankSum = 1
|
||||||
For i = 1 To ABILITY_GROUPS_COUNT - 1
|
For i = 1 To ABILITY_GROUPS_COUNT - 1
|
||||||
nextAbility = ChooseMenuItemId(mnuAbilityGroups(), msWithoutValues, ABILITY_GROUPS_COUNT, "Choose your " + LCase$(Ranks(i).label) + " ability?", TRUE)
|
nextAbility = ChooseMenuItemId(mnuAbilityGroups(), msWithoutValues, ABILITY_GROUPS_COUNT, "Choose your " +
|
||||||
mnuAbilityGroups(nextAbility).isVisible = FALSE
|
LCase$(Ranks(i).label) + " ability?", TRUE) mnuAbilityGroups(nextAbility).isVisible = FALSE abilityRanks(nextAbility) =
|
||||||
abilityRanks(nextAbility) = i
|
i rankSum = rankSum + i + 1 groupSum = groupSum + nextAbility Next ' General formula for last choice given 1 to count
|
||||||
rankSum = rankSum + i + 1
|
based indexing is this ' (Sum from 1 to count) - (Sum of all previous choice IDs) '
|
||||||
groupSum = groupSum + nextAbility
|
Sum(1..AllAttributesCount)-Sum(Choice[1]..Choice[AllAttributesCount-1]) lastGroup = rankSum - groupSum
|
||||||
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
|
abilityRanks(lastGroup) = ABILITY_GROUPS_COUNT
|
||||||
|
|
||||||
' Spend ability points
|
' Spend ability points
|
||||||
@@ -361,11 +335,9 @@ Sub CGGetAbilities (ch As CharacterType)
|
|||||||
ReDim values(1 To count) As Integer
|
ReDim values(1 To count) As Integer
|
||||||
For abilityPoints = GetAbilityPointsForRank(rank) To 1 Step -1
|
For abilityPoints = GetAbilityPointsForRank(rank) To 1 Step -1
|
||||||
Call FillAbilityValues(ch, values(), group)
|
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?")
|
ability = ChooseStringIdWithValues(abilityNames(), values(), msWithValues, count, "Which " +
|
||||||
Call SetAbilityValue(ch, group, ability, GetAbilityValue(ch, group, ability) + 1)
|
LCase$(Abilities(i).singular) + " would you like to spend 1 of your " + itos$(abilityPoints) + " points on?") Call
|
||||||
Next
|
SetAbilityValue(ch, group, ability, GetAbilityValue(ch, group, ability) + 1) Next Next End Sub
|
||||||
Next
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub CGGetBackgrounds (ch As CharacterType)
|
Sub CGGetBackgrounds (ch As CharacterType)
|
||||||
' Spend background points
|
' Spend background points
|
||||||
@@ -376,11 +348,9 @@ Sub CGGetBackgrounds (ch As CharacterType)
|
|||||||
While backgroundPoints > 0
|
While backgroundPoints > 0
|
||||||
Cls
|
Cls
|
||||||
Call FillBackgrounds(ch, backgroundValues())
|
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?")
|
background = ChooseStringIdWithValues(Backgrounds(), backgroundValues(), ms, BACKGROUNDS_COUNT, "Which
|
||||||
Call SetBackground(ch, background, GetBackground(ch, background) + 1)
|
background do you want to spend 1 of your " + itos$(backgroundPoints) + " points on?") Call SetBackground(ch,
|
||||||
backgroundPoints = backgroundPoints - 1
|
background, GetBackground(ch, background) + 1) backgroundPoints = backgroundPoints - 1 Wend End Sub
|
||||||
Wend
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub CGGetRoad (ch As CharacterType)
|
Sub CGGetRoad (ch As CharacterType)
|
||||||
ch.roadName = "Humanity"
|
ch.roadName = "Humanity"
|
||||||
@@ -395,12 +365,9 @@ Sub CGSpendVirtuePoints (ch As CharacterType)
|
|||||||
Dim values(1 To VIRTUES_COUNT) As Integer
|
Dim values(1 To VIRTUES_COUNT) As Integer
|
||||||
While virtuePoints > 0
|
While virtuePoints > 0
|
||||||
Call FillVirtues(ch, values())
|
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?")
|
virtue = ChooseStringIdWithValues(Virtues(), values(), ms, VIRTUES_COUNT, "Which virtue do you want to spend 1
|
||||||
If virtue = 0 Then virtue = GetRandomInt(1, VIRTUES_COUNT)
|
of your " + itos$(virtuePoints) + " points on?") If virtue = 0 Then virtue = GetRandomInt(1, VIRTUES_COUNT) Call
|
||||||
Call SetVirtue(ch, virtue, GetVirtue(ch, virtue) + 1)
|
SetVirtue(ch, virtue, GetVirtue(ch, virtue) + 1) virtuePoints = virtuePoints - 1 Wend End Sub
|
||||||
virtuePoints = virtuePoints - 1
|
|
||||||
Wend
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub CGGetDerangement (ch As CharacterType)
|
Sub CGGetDerangement (ch As CharacterType)
|
||||||
If ch.clan = CLAN_MALKAVIAN Then
|
If ch.clan = CLAN_MALKAVIAN Then
|
||||||
@@ -409,10 +376,8 @@ Sub CGGetDerangement (ch As CharacterType)
|
|||||||
Call NewMenuStyle(ms)
|
Call NewMenuStyle(ms)
|
||||||
ms.useColors = TRUE
|
ms.useColors = TRUE
|
||||||
|
|
||||||
ch.derangementId = ChooseStringIdWithColors(DerangementLabels(), DerangementColors(), ms, "Which derangement do you want?")
|
ch.derangementId = ChooseStringIdWithColors(DerangementLabels(), DerangementColors(), ms, "Which derangement do
|
||||||
If ch.derangementId = 0 Then ch.derangementId = GetRandomInt(1, DERANGEMENTS_COUNT)
|
you want?") If ch.derangementId = 0 Then ch.derangementId = GetRandomInt(1, DERANGEMENTS_COUNT) End If End Sub
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub CGSpendFreebiePoints (ch As CharacterType)
|
Sub CGSpendFreebiePoints (ch As CharacterType)
|
||||||
End Sub
|
End Sub
|
||||||
@@ -586,15 +551,15 @@ Sub ShowCharacterSheet (ch As CharacterType)
|
|||||||
Call FillBackgrounds(ch, backgroundValues())
|
Call FillBackgrounds(ch, backgroundValues())
|
||||||
|
|
||||||
'... 0123456789
|
'... 0123456789
|
||||||
'160 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
'160 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
'170 <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>
|
'180 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
'190 <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>
|
'200 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
'210 <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>
|
'220 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
'230 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD>
|
'230 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>2<EFBFBD><32><EFBFBD><EFBFBD>
|
||||||
' enquote forms s/^([ɺ<><C9BA><EFBFBD>].*[<5B><><EFBFBD><EFBFBD>])$/print "$1"/g
|
' enquote forms s/^([ɺ<><C9BA><EFBFBD>].*[<5B><><EFBFBD><EFBFBD>])$/print "$1"/g
|
||||||
|
|
||||||
Dim disciplineStrings(3) As String
|
Dim disciplineStrings(3) As String
|
||||||
disciplineStringsIndex = 0
|
disciplineStringsIndex = 0
|
||||||
@@ -627,47 +592,54 @@ Sub ShowCharacterSheet (ch As CharacterType)
|
|||||||
Call MakeWrapLines(derangementStrings(), allDerangementsLine$, 37, 5)
|
Call MakeWrapLines(derangementStrings(), allDerangementsLine$, 37, 5)
|
||||||
|
|
||||||
Cls
|
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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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> Name: " + MakeFitL$(ch.name, 30, " ") + " <20> Gender: " + MakeFitL$(Genders(ch.gender), 14, " ") + "
|
||||||
Print "<22> Clan: " + MakeFitL$(Clans(ch.clan), 30, " ") + " <20> Age: " + MakeFitL$(ch.age$, 32, " ") + " <20>"
|
Generation: " + MakeFitR$(itos$(ch.generation), 2, " ") + " <20>" Print "<22> Clan: " + MakeFitL$(Clans(ch.clan), 30, " ") + "
|
||||||
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>"
|
<EFBFBD> Age: " + MakeFitL$(ch.age$, 32, " ") + " <20>"
|
||||||
Print "<22> Attributes <20> Chronicle: " + MakeFitL$(ch.chronicle$, 26, " ") + " <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, " ") +
|
||||||
Print "<22> Physical Social Mental <20> Haven: " + MakeFitL$(ch.haven$, 30, " ") + " <20>"
|
" <20>" Print "<22> Attributes <20> Chronicle: " + MakeFitL$(ch.chronicle$, 26, " ") + " <20>" Print "<22>
|
||||||
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>"
|
Physical Social Mental <20> Haven: " + MakeFitL$(ch.haven$, 30, " ") + " <20>" Print "<22> Str. " +
|
||||||
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>"
|
MakeFitL$(itos$(ch.attr_strength), 7, " ") + " App. " + MakeFitL$(itos$(ch.attr_appearance), 7, " ") + " Int. " +
|
||||||
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>"
|
MakeFitL$(itos$(ch.attr_intelligence), 5, " ") + " <EFBFBD> Concept: " + MakeFitL$(ch.concept$, 28, " ") + " <20>" Print "<22> Dex. "
|
||||||
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>"
|
+ MakeFitL$(itos$(ch.attr_dexterity), 7, " ") + " Cha. " + MakeFitL$(itos$(ch.attr_charisma), 7, " ") + " Per. " +
|
||||||
Print "<22> Disciplines: <20> " + derangementStrings(1) + " <20>"
|
MakeFitL$(itos$(ch.attr_perception), 5, " ") + "
|
||||||
Print "<22> " + MakeFitL$(disciplineStrings(0), 36, " ") + " <20> " + MakeFitL$(derangementStrings(2), 37, "_") + " <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><EFBFBD><EFBFBD>"
|
||||||
Print "<22> " + MakeFitL$(disciplineStrings(1), 36, " ") + " <EFBFBD> " + MakeFitL$(derangementStrings(3), 37, "_") + " <20>"
|
Print "<22> Sta. " + MakeFitL$(itos$(ch.attr_stamina), 7, " ") + " Man. " + MakeFitL$(itos$(ch.attr_manipulation), 7, "
|
||||||
Print "<22> " + MakeFitL$(disciplineStrings(2), 36, " ") + " <20> " + MakeFitL$(derangementStrings(4), 37, "_") + " <20>"
|
") + " Wit. " + MakeFitL$(itos$(ch.attr_wits), 5, " ") + " <20> Derangements: <20>" Print
|
||||||
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><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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) +
|
||||||
Print "<22> " + MakeFitL$(ch.roadName + ": " + itos$(ch.roadValue), 36, " ") + " <20> Nature: " + MakeFitL$(Archetypes(ch.nature), 29, " ") + " <20>"
|
" <20>" Print "<22> Disciplines: <20> " + derangementStrings(1) + " <20>" Print "<22> " +
|
||||||
Print "<22> Willpower: " + MakeFitL$(itos$(ch.willpower), 25, " ") + " <20> Demeanor: " + MakeFitL$(Archetypes(ch.demeanor), 27, " ") + " <20>"
|
MakeFitL$(disciplineStrings(0), 36, " ") + " <20> " + MakeFitL$(derangementStrings(2), 37, "_") + " <20>" Print "<22> " +
|
||||||
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>"
|
MakeFitL$(disciplineStrings(1), 36, " ") + " <20> " + MakeFitL$(derangementStrings(3), 37, "_") + " <20>" Print "<22> " +
|
||||||
Print "<22> <20>"
|
MakeFitL$(disciplineStrings(2), 36, " ") + " <20> " + MakeFitL$(derangementStrings(4), 37, "_") + " <20>" Print
|
||||||
Print "<22> <20>"
|
"<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> " + MakeFitL$(ch.roadName + ": " + itos$(ch.roadValue), 36, " ") + " <20> Nature: " +
|
||||||
Print "<22> <<PRESS ANY KEY TO CONTINUE>> <20>"
|
MakeFitL$(Archetypes(ch.nature), 29, " ") + " <20>" Print "<22> Willpower: " + MakeFitL$(itos$(ch.willpower), 25, " ") + " <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>ͼ"
|
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
|
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><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><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$("Abilities", 76, " ") + " <20>"
|
||||||
Print "<22> " + MakeFitC$("Talents", 25, " ") + " " + MakeFitC$("Skills", 25, " ") + " " + MakeFitC$("Knowledges", 24, " ") + " <20>"
|
Print "<22> " + MakeFitC$("Talents", 25, " ") + " " + MakeFitC$("Skills", 25, " ") + " " + MakeFitC$("Knowledges", 24,
|
||||||
For index = 1 To 10
|
" ") + " <20>" For index = 1 To 10 Print "<22> " + MakeFitC(MakeFitL$(Talents(index) + ":", 14, " ") + itos$(GetTalent(ch,
|
||||||
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>"
|
index)), 25, " ") + " " + MakeFitC(MakeFitL$(Skills(index) + ":", 14, " ") + itos$(GetSkill(ch, index)), 25, " ") + " "
|
||||||
Next
|
+ MakeFitC(MakeFitL$(Knowledges(index) + ":", 14, " ") + itos$(GetKnowledge(ch, index)), 24, " ") + " <20>" Next Print
|
||||||
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>"
|
"<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> Backgrounds: <20> Virtues: <20>"
|
||||||
Print "<22> " + MakeFitL$(backgroundStrings(0), 36, " ") + " <20> " + MakeFitB$("Conscience:", itos$(ch.conscience), 37, " ") + " <20>"
|
Print "<22> " + MakeFitL$(backgroundStrings(0), 36, " ") + " <20> " + MakeFitB$("Conscience:", itos$(ch.conscience), 37, "
|
||||||
Print "<22> " + MakeFitL$(backgroundStrings(1), 36, " ") + " <20> " + MakeFitB$("Self-Control:", itos$(ch.selfControl), 37, " ") + " <20>"
|
") + " <20>" Print "<22> " + MakeFitL$(backgroundStrings(1), 36, " ") + " <20> " + MakeFitB$("Self-Control:",
|
||||||
Print "<22> " + MakeFitL$(backgroundStrings(2), 36, " ") + " <20> " + MakeFitB$("Courage:", itos$(ch.courage), 37, " ") + " <20>"
|
itos$(ch.selfControl), 37, " ") + " <20>" Print "<22> " + MakeFitL$(backgroundStrings(2), 36, " ") + " <20> " +
|
||||||
Print "<22> " + MakeFitL$(backgroundStrings(3), 36, " ") + " <20> " + MakeFitL$("", 37, " ") + " <20>"
|
MakeFitB$("Courage:", itos$(ch.courage), 37, " ") + " <20>" Print "<22> " + MakeFitL$(backgroundStrings(3), 36, " ") + " <20> " +
|
||||||
Print "<22> " + MakeFitL$(backgroundStrings(4), 36, " ") + " <20> " + MakeFitL$("", 37, " ") + " <20>"
|
MakeFitL$("", 37, " ") + " <20>" Print "<22> " + MakeFitL$(backgroundStrings(4), 36, " ") + " <20> " + MakeFitL$("", 37, " ") + "
|
||||||
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
|
||||||
Print "<22> <<PRESS ANY KEY TO CONTINUE>> <20>"
|
"<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><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
|
Call PressAnyKeyToContinue
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@@ -698,10 +670,8 @@ Sub Choice6
|
|||||||
Print "Unnamed choice 6"
|
Print "Unnamed choice 6"
|
||||||
End Sub
|
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.
|
' Like the character generator but for vehicles. Much simpler with fewer questions. Prints a vehicle sheet when done.
|
||||||
Sub VehicleGenerator
|
Never finished and crashes mid way through currently. Sub VehicleGenerator Print "VehicleGenerator" End Sub
|
||||||
Print "VehicleGenerator"
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Sub PressAnyKeyToContinue ()
|
Sub PressAnyKeyToContinue ()
|
||||||
While InKey$ = "": Wend
|
While InKey$ = "": Wend
|
||||||
@@ -822,5 +792,6 @@ End Sub
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** #}*/
|
/** #}*/
|
||||||
#endif // End !defined SBF_H__
|
#endif // End !defined SBF_H__
|
||||||
|
|||||||
160
sbf-cpp/test.cpp
160
sbf-cpp/test.cpp
@@ -1,65 +1,80 @@
|
|||||||
#define _XOPEN_SOURCE_EXTENDED
|
#define _XOPEN_SOURCE_EXTENDED
|
||||||
#include <iostream>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <string>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <vector>
|
|
||||||
#include "test.h"
|
#include "test.h"
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstdio>
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
// using namespace std;
|
// using namespace std;
|
||||||
using std::cout;
|
|
||||||
using std::tuple;
|
|
||||||
using std::wcerr;
|
|
||||||
using std::string;
|
using std::string;
|
||||||
using std::endl;
|
|
||||||
using std::pair;
|
|
||||||
using std::get;
|
|
||||||
using std::make_tuple;
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using Test::TestResults;
|
|
||||||
using std::optional;
|
|
||||||
using std::function;
|
|
||||||
using std::for_each;
|
|
||||||
|
|
||||||
// using namespace Test;
|
// using namespace Test;
|
||||||
|
|
||||||
namespace Test {
|
namespace Test {
|
||||||
// Test lifecycle
|
// Test lifecycle
|
||||||
// suiteSetupFn(); - This is called to allocate any suite level resources. This is called once when the suite begins.
|
// 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.
|
// These functions may be called in parallel but execution will not proceed past this block until they have all
|
||||||
// testSetupFn(); - This is called once for every test in tests. You may use it to allocate resources or setup mocks, stubs, and spies.
|
// finished.
|
||||||
// testFn(...); - This is called once for every test to execute the test.
|
// testSetupFn(); - This is called once for every test in tests. You may use it to allocate resources or setup mocks,
|
||||||
// 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.
|
// stubs, and spies. testFn(...); - This is called once for every test to execute the test. Only one of these test
|
||||||
// maybe_compare_function; - This is the highest priority compare function. If it is not nullptr then it will be called.
|
// functions will actually be run for each test in tests. They should return true if the test passed, return false if
|
||||||
// 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.
|
// the test failed or there was an error, and be nullptr if they should be skipped. The executed function will be
|
||||||
// [](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.
|
// called with expectedOutput and the result of testFn(...). They can be used to test functions with side effects,
|
||||||
// testTeardownFn(); - This is called once for every test in tests. You must free/release any resources allocated by testSetupFn.
|
// 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.
|
// 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.
|
// Collect reports - Ths step is not visible to the user at this point, but data returned by all of the test functions
|
||||||
// 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.
|
// 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.
|
// 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.
|
// Suite setup/teardown functions should allocate/free.
|
||||||
// Test setup/teardown functions should consume the data allocated by Suite setup.
|
// 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.
|
// Test setup functions may allocate additional resources. If they do then the allocated resources they should be
|
||||||
// Suite and/or Test compare functions may consume this shared data, but it will not be shared with the execution of testFn.
|
// 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.
|
// This function is called to execute a test suite. You provide it with some configuration info, optional utility
|
||||||
// Not all parameters are named in code, but they are named and explained in the comments and will be described by those names below.
|
// 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.
|
// 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.
|
// FnToTest testFn - This is the function to test. This may be replaced if necessary by function. It may not currently
|
||||||
// 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.
|
// 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.
|
// 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.
|
// 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.
|
// bool(*)(const TResult expected, const TResult actual) maybe_compare_function - This is optional. If unset or set
|
||||||
// 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.
|
// to nullptr it is skipped. If set to a function it is called to evaluate the test results. It takes the expected
|
||||||
// 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.
|
// and actual results as parameters and should return true if the test passed and false otherwise. This may be
|
||||||
// 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.
|
// changed to return a TestResults at some point. void(*)(TInputParams...) testSetupFn - This is optional. If unset
|
||||||
// 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.
|
// or set to nullptr it is skipped. If set to a function it is called before each test to setup the environment for
|
||||||
// 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.
|
// the test. You may use it to allocate resources and setup mocks, stubs, and spies. void(*)(TInputParams...)
|
||||||
// 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.
|
// testTeardownFn - This is optiona. If unset or set to nullptr it is skipped. If set to a function it is called
|
||||||
// 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.
|
// 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(
|
// results = collect_and_report_TestResultstest_fn(
|
||||||
// "Test: functionUnderTest",
|
// "Test: functionUnderTest",
|
||||||
// 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.
|
// The suites can be run from one file as such. From a file called ThingDoer_test.cpp to test the class/methods
|
||||||
// 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.
|
// 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 test_main_ThingDoer(int argc, char** argv) {
|
||||||
// TestResults results;
|
// TestResults results;
|
||||||
// results = collect_and_report_TestResults(results, testFn("doThing1", ...), argc, argv);
|
// results = collect_and_report_TestResults(results, testFn("doThing1", ...), argc, argv);
|
||||||
// results = collect_and_report_TestResults(results, testFn("doThing2", ...), argc, argv);
|
// results = collect_and_report_TestResults(results, testFn("doThing2", ...), argc, argv);
|
||||||
// return results;
|
// 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(...).
|
// Then some test harness either generated or explicit can call test_main_ThingDoer(...) and optionally reported there.
|
||||||
// You can combine test results with results = results + testFn(..); and then collect_and_report_TestResults on the aggregate TestResults value.
|
// 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
|
// _Step_9 - if T2 is a single value then make_tuple<T2>(T2) and call longer version
|
||||||
// auto testFunction = [](int id){return id==0?"":"";};
|
// 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())
|
// 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.
|
// Also allow make_tuple(T2) if the last param is not a tuple.
|
||||||
|
|
||||||
TestResults::TestResults()
|
TestResults::TestResults() : errors_(0), failed_(0), passed_(0), skipped_(0), total_(0) {}
|
||||||
: errors_(0)
|
|
||||||
, failed_(0)
|
|
||||||
, passed_(0)
|
|
||||||
, skipped_(0)
|
|
||||||
, total_(0) {}
|
|
||||||
|
|
||||||
TestResults::TestResults(const TestResults& other)
|
TestResults::TestResults(const TestResults& other)
|
||||||
: error_messages_(other.error_messages_)
|
: error_messages_(other.error_messages_),
|
||||||
, errors_(other.errors_)
|
errors_(other.errors_),
|
||||||
, failed_(other.failed_)
|
failed_(other.failed_),
|
||||||
, failure_messages_(other.failure_messages_)
|
failure_messages_(other.failure_messages_),
|
||||||
, passed_(other.passed_)
|
passed_(other.passed_),
|
||||||
, skip_messages_(other.skip_messages_)
|
skip_messages_(other.skip_messages_),
|
||||||
, skipped_(other.skipped_)
|
skipped_(other.skipped_),
|
||||||
, total_(other.total_) {}
|
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)
|
TestResults::TestResults(uint32_t errors,
|
||||||
: error_messages_(error_messages)
|
uint32_t failed,
|
||||||
, errors_(errors)
|
uint32_t passed,
|
||||||
, failed_(failed)
|
uint32_t skipped,
|
||||||
, failure_messages_(failure_messages)
|
uint32_t total,
|
||||||
, passed_(passed)
|
vector<string> error_messages,
|
||||||
, skip_messages_(skip_messages)
|
vector<string> failure_messages,
|
||||||
, skipped_(skipped)
|
vector<string> skip_messages)
|
||||||
, total_(total) {}
|
: 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() {
|
TestResults& TestResults::error() {
|
||||||
errors_++;
|
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(), skip_messages_.begin(), skip_messages_.end());
|
||||||
skip_messages.insert(skip_messages.end(), other.skip_messages_.begin(), other.skip_messages_.end());
|
skip_messages.insert(skip_messages.end(), other.skip_messages_.begin(), other.skip_messages_.end());
|
||||||
|
|
||||||
return TestResults(
|
return TestResults(errors_ + other.errors_,
|
||||||
errors_ + other.errors_,
|
|
||||||
failed_ + other.failed_,
|
failed_ + other.failed_,
|
||||||
passed_ + other.passed_,
|
passed_ + other.passed_,
|
||||||
skipped_ + other.skipped_,
|
skipped_ + other.skipped_,
|
||||||
|
|||||||
210
sbf-cpp/test.h
210
sbf-cpp/test.h
@@ -10,25 +10,34 @@
|
|||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <tuple>
|
|
||||||
#include <utility>
|
|
||||||
#include <string>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <string>
|
||||||
|
#include <tuple>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
// Test lifecycle
|
// Test lifecycle
|
||||||
// suite_setup_function(); - This is called to allocate any suite level resources. This is called once when the suite begins.
|
// suite_setup_function(); - This is called to allocate any suite level resources. This is called once when the suite
|
||||||
// These functions may be called in parallel but execution will not proceed past this block until they have all finished.
|
// begins. These functions may be called in parallel but execution will not proceed past this block until they have all
|
||||||
// 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.
|
// finished.
|
||||||
// function_to_test(...); - This is called once for every test to execute the test.
|
// test_setup_function(); - This is called once for every test in tests. You may use it to allocate resources or setup
|
||||||
// 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.
|
// mocks, stubs, and spies. function_to_test(...); - This is called once for every test to execute the test. Only one
|
||||||
// test_compare_function; - This is the highest priority compare function. If it is not nullptr then it will be called.
|
// of these test functions will actually be run for each test in tests. They should return true if the test passed,
|
||||||
// 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.
|
// return false if the test failed or there was an error, and be nullptr if they should be skipped. The executed
|
||||||
// [](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.
|
// function will be called with expected_output and the result of function_to_test(...). They can be used to test
|
||||||
// test_teardown_function(); - This is called once for every test in tests. You must free/release any resources allocated by test_setup_function.
|
// 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.
|
// 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.
|
// Collect reports - Ths step is not visible to the user at this point, but data returned by all of the test functions
|
||||||
// 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.
|
// 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
|
// Tuple printer from: https://stackoverflow.com/questions/6245735/pretty-print-stdtuple/31116392#58417285
|
||||||
template <typename TChar, typename TTraits, typename... TArgs>
|
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>
|
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()) {
|
if (expected.size() != actual.size()) {
|
||||||
error_message << "size mismatch expected: " << expected.size() << ", actual: " << actual.size();
|
error_message << "size mismatch expected: " << expected.size() << ", actual: " << actual.size();
|
||||||
return error_message;
|
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++) {
|
for (size_t index = 0; index < expected.size(); index++) {
|
||||||
if (expected[index] != actual[index]) {
|
if (expected[index] != actual[index]) {
|
||||||
error_message << "vectors differ at index " << index
|
error_message << "vectors differ at index " << index << ", \"" << expected[index] << "\" != \"" << actual[index]
|
||||||
<< ", \"" << expected[index] << "\" != \"" << actual[index]
|
<< "\", expected: \"" << expected << "\", actual: \"" << actual << "\"";
|
||||||
<< "\", expected: \"" << expected
|
|
||||||
<< "\", actual: \"" << actual << "\"";
|
|
||||||
return error_message;
|
return error_message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -70,10 +79,9 @@ auto& compare(std::basic_ostream<TChar, TTraits>& error_message, std::vector<TIt
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Test {
|
namespace Test {
|
||||||
using std::tuple;
|
|
||||||
using std::pair;
|
|
||||||
using std::vector;
|
|
||||||
using std::string;
|
using std::string;
|
||||||
|
using std::tuple;
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
/// @brief
|
/// @brief
|
||||||
class TestResults {
|
class TestResults {
|
||||||
@@ -94,7 +102,14 @@ namespace Test {
|
|||||||
/// @param error_messages The list of error messages.
|
/// @param error_messages The list of error messages.
|
||||||
/// @param failure_messages The list of failure messages.
|
/// @param failure_messages The list of failure messages.
|
||||||
/// @param skip_messages The list of skip 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.
|
/// @brief Adds an error. This increments errors.
|
||||||
/// @return A reference to this instance. Used for chaining.
|
/// @return A reference to this instance. Used for chaining.
|
||||||
@@ -198,13 +213,25 @@ namespace Test {
|
|||||||
/// @tparam TResult
|
/// @tparam TResult
|
||||||
/// @tparam ...TInputParams
|
/// @tparam ...TInputParams
|
||||||
template <typename TResult, typename... TInputParams>
|
template <typename TResult, typename... TInputParams>
|
||||||
using TestTuple = std::tuple<
|
using TestTuple =
|
||||||
std::string /* test_name */,
|
std::tuple<std::string /* test_name */,
|
||||||
TResult /* expected_output */,
|
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. */,
|
std::tuple<TInputParams...> /* input_params - The input parameters for this test. These will be used when
|
||||||
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. */,
|
calling std::apply with function_to_test to execute the test. */
|
||||||
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. */,
|
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. */>;
|
bool /* is_enabled If this is false the test, setup, and teardown functions are not run. */>;
|
||||||
|
|
||||||
/// @brief
|
/// @brief
|
||||||
@@ -212,31 +239,45 @@ namespace Test {
|
|||||||
/// @tparam TFunctionToTest
|
/// @tparam TFunctionToTest
|
||||||
/// @tparam ...TInputParams
|
/// @tparam ...TInputParams
|
||||||
template <typename TResult, typename... TInputParams>
|
template <typename TResult, typename... TInputParams>
|
||||||
using TestSuite = std::tuple<
|
using TestSuite = std::tuple<std::string,
|
||||||
std::string,
|
|
||||||
std::function<TResult(TInputParams...)>,
|
std::function<TResult(TInputParams...)>,
|
||||||
std::vector<TestTuple<TResult, TInputParams...>>,
|
std::vector<TestTuple<TResult, TInputParams...>>,
|
||||||
MaybeTestCompareFunction<TResult>,
|
MaybeTestCompareFunction<TResult>,
|
||||||
MaybeTestConfigureFunction,
|
MaybeTestConfigureFunction,
|
||||||
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.
|
// This function is called to execute a test suite. You provide it with some configuration info, optional utility
|
||||||
// Not all parameters are named in code, but they are named and explained in the comments and will be described by those names below.
|
// 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.
|
// 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.
|
// TFunctionToTest function_to_test - This is the function to test. This may be replaced if necessary by
|
||||||
// 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.
|
// 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.
|
// 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.
|
// 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.
|
// bool(*)(const TResult expected, const TResult actual) test_compare_function - This is optional. If unset or set
|
||||||
// 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.
|
// to nullptr it is skipped. If set to a function it is called to evaluate the test results. It takes the expected
|
||||||
// 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.
|
// and actual results as parameters and should return true if the test passed and false otherwise. This may be
|
||||||
// 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.
|
// changed to return a TestResults at some point. void(*)(TInputParams...) test_setup_function - This is optional.
|
||||||
// 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.
|
// If unset or set to nullptr it is skipped. If set to a function it is called before each test to setup the
|
||||||
// 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.
|
// environment for the test. 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.
|
// void(*)(TInputParams...) test_teardown_function - This is optiona. If unset or set to nullptr it is skipped. If
|
||||||
// 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.
|
// 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(
|
// results = collect_and_report_test_resultstest_fn(
|
||||||
// "Test: function_under_test",
|
// "Test: function_under_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.
|
// The suites can be run from one file as such. From a file called ThingDoer_test.cpp to test the class/methods
|
||||||
// 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.
|
// 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 test_main_ThingDoer(int argc, char** argv) {
|
||||||
// TestResults results;
|
// 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_thing1", ...), argc, argv);
|
||||||
// results = collect_and_report_test_results(results, function_to_test("do_thing2", ...), argc, argv);
|
// results = collect_and_report_test_results(results, function_to_test("do_thing2", ...), argc, argv);
|
||||||
// return results;
|
// 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(...).
|
// Then some test harness either generated or explicit can call test_main_ThingDoer(...) and optionally reported there.
|
||||||
// You can combine test results with results = results + function_to_test(..); and then collect_and_report_test_results on the aggregate TestResults value.
|
// 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
|
/// @brief
|
||||||
/// @tparam TResult The result type of the test.
|
/// @tparam TResult The result type of the test.
|
||||||
/// @tparam TInputParams... The types of parameters sent to the test function.
|
/// @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 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 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 suite_compare_function A function used to compare the expected and actual test results. This can be
|
||||||
/// @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.
|
/// 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 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.
|
/// @param is_enabled If false none of these tests are run and they are all reported as skipped.
|
||||||
template <typename TResult, typename... TInputParams>
|
template <typename TResult, typename... TInputParams>
|
||||||
TestResults execute_suite(
|
TestResults execute_suite(std::string suite_label,
|
||||||
std::string suite_label,
|
|
||||||
std::function<TResult(TInputParams...)> function_to_test,
|
std::function<TResult(TInputParams...)> function_to_test,
|
||||||
vector<TestTuple<TResult, TInputParams...>> tests,
|
vector<TestTuple<TResult, TInputParams...>> tests,
|
||||||
MaybeTestCompareFunction<TResult> suite_compare = std::nullopt,
|
MaybeTestCompareFunction<TResult> suite_compare = std::nullopt,
|
||||||
MaybeTestConfigureFunction before_all = std::nullopt,
|
MaybeTestConfigureFunction before_all = std::nullopt,
|
||||||
MaybeTestConfigureFunction after_all = std::nullopt,
|
MaybeTestConfigureFunction after_all = std::nullopt,
|
||||||
bool is_enabled = true
|
bool is_enabled = true) {
|
||||||
) {
|
|
||||||
TestResults results;
|
TestResults results;
|
||||||
std::cout << "🚀Beginning Suite: " << suite_label << std::endl;
|
std::cout << "🚀Beginning Suite: " << suite_label << std::endl;
|
||||||
|
|
||||||
@@ -289,20 +335,18 @@ namespace Test {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Step 2: Execute Tests
|
// Step 2: Execute Tests
|
||||||
for_each(tests.begin(), tests.end(), [&suite_label, &function_to_test, &results, &suite_compare](
|
for_each(tests.begin(),
|
||||||
TestTuple<TResult, TInputParams...> test_data
|
tests.end(),
|
||||||
) {
|
[&suite_label, &function_to_test, &results, &suite_compare](TestTuple<TResult, TInputParams...> test_data) {
|
||||||
|
|
||||||
// Step 2a: Extract our variables from the TestTuple.
|
// Step 2a: Extract our variables from the TestTuple.
|
||||||
const std::string& test_name = std::get<0>(test_data);
|
const std::string& test_name = std::get<0>(test_data);
|
||||||
const std::string qualified_test_name = suite_label + "::" + test_name;
|
const std::string qualified_test_name = suite_label + "::" + test_name;
|
||||||
const TResult& expected_output = std::get<1>(test_data);
|
const TResult& expected_output = std::get<1>(test_data);
|
||||||
std::tuple<TInputParams...> input_params = std::get<2>(test_data);
|
std::tuple<TInputParams...> input_params = std::get<2>(test_data);
|
||||||
MaybeTestCompareFunction<TResult> maybe_compare_function = std::get<3>(test_data);
|
MaybeTestCompareFunction<TResult> maybe_compare_function = std::get<3>(test_data);
|
||||||
TestCompareFunction<TResult> compare_function = maybe_compare_function.has_value()
|
TestCompareFunction<TResult> compare_function =
|
||||||
? *maybe_compare_function
|
maybe_compare_function.has_value() ? *maybe_compare_function
|
||||||
: suite_compare.has_value()
|
: suite_compare.has_value() ? *suite_compare
|
||||||
? *suite_compare
|
|
||||||
: [](const TResult& l, const TResult& r) { return l == r; };
|
: [](const TResult& l, const TResult& r) { return l == r; };
|
||||||
MaybeTestConfigureFunction before_each = std::get<4>(test_data);
|
MaybeTestConfigureFunction before_each = std::get<4>(test_data);
|
||||||
MaybeTestConfigureFunction after_each = std::get<5>(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 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 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 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 test_compare_fn An optional function that can be used to compare the expected and actual return values. This
|
||||||
/// @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.
|
/// 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 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.
|
/// @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.
|
/// @return A TestTuple suitable for use as a test run when calling test_fn.
|
||||||
template <typename TResult, typename... TInputParams>
|
template <typename TResult, typename... TInputParams>
|
||||||
TestTuple<TResult, TInputParams...>
|
TestTuple<TResult, TInputParams...> make_test(const string& test_name,
|
||||||
make_test(
|
|
||||||
const string& test_name,
|
|
||||||
const TResult& expected,
|
const TResult& expected,
|
||||||
tuple<TInputParams...> input_params,
|
tuple<TInputParams...> input_params,
|
||||||
MaybeTestCompareFunction<TResult> test_compare_fn = std::nullopt,
|
MaybeTestCompareFunction<TResult> test_compare_fn = std::nullopt,
|
||||||
MaybeTestConfigureFunction before_each = std::nullopt,
|
MaybeTestConfigureFunction before_each = std::nullopt,
|
||||||
MaybeTestConfigureFunction after_each = std::nullopt,
|
MaybeTestConfigureFunction after_each = std::nullopt,
|
||||||
bool is_enabled = true) {
|
bool is_enabled = true) {
|
||||||
return make_tuple(
|
return make_tuple(test_name, expected, input_params, test_compare_fn, before_each, after_each, is_enabled);
|
||||||
test_name,
|
|
||||||
expected,
|
|
||||||
input_params,
|
|
||||||
test_compare_fn,
|
|
||||||
before_each,
|
|
||||||
after_each,
|
|
||||||
is_enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief
|
/// @brief
|
||||||
@@ -410,8 +447,7 @@ namespace Test {
|
|||||||
/// @param is_enabled
|
/// @param is_enabled
|
||||||
/// @return
|
/// @return
|
||||||
template <typename TResult, typename TFunctionToTest, typename... TInputParams>
|
template <typename TResult, typename TFunctionToTest, typename... TInputParams>
|
||||||
TestSuite<TResult, TInputParams...> make_test_suite(
|
TestSuite<TResult, TInputParams...> make_test_suite(const string& suite_name,
|
||||||
const string& suite_name,
|
|
||||||
TFunctionToTest function_to_test,
|
TFunctionToTest function_to_test,
|
||||||
vector<TestTuple<TResult, TInputParams...>> test_data,
|
vector<TestTuple<TResult, TInputParams...>> test_data,
|
||||||
MaybeTestCompareFunction<TResult> compare = std::nullopt,
|
MaybeTestCompareFunction<TResult> compare = std::nullopt,
|
||||||
@@ -424,9 +460,7 @@ namespace Test {
|
|||||||
template <typename TResult, typename... TInputParams>
|
template <typename TResult, typename... TInputParams>
|
||||||
TestResults execute_suite(const TestSuite<TResult, TInputParams...>& test_suite) {
|
TestResults execute_suite(const TestSuite<TResult, TInputParams...>& test_suite) {
|
||||||
return execute_suite<TResult, TInputParams...>(
|
return execute_suite<TResult, TInputParams...>(
|
||||||
std::get<0>(test_suite),
|
std::get<0>(test_suite), std::get<1>(test_suite), std::get<2>(test_suite)
|
||||||
std::get<1>(test_suite),
|
|
||||||
std::get<2>(test_suite)
|
|
||||||
// TODO: make this work for the optional parts of the tuple too.
|
// TODO: make this work for the optional parts of the tuple too.
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -437,9 +471,7 @@ namespace Test {
|
|||||||
/// @param second
|
/// @param second
|
||||||
/// @return
|
/// @return
|
||||||
template <typename... TInputParams>
|
template <typename... TInputParams>
|
||||||
MaybeTestConfigureFunction coalesce(
|
MaybeTestConfigureFunction coalesce(MaybeTestConfigureFunction first, MaybeTestConfigureFunction second) {
|
||||||
MaybeTestConfigureFunction first,
|
|
||||||
MaybeTestConfigureFunction second) {
|
|
||||||
if (first.has_value()) {
|
if (first.has_value()) {
|
||||||
if (second.has_value()) {
|
if (second.has_value()) {
|
||||||
// This is the only place we actually need to combine them.
|
// This is the only place we actually need to combine them.
|
||||||
@@ -457,10 +489,12 @@ namespace Test {
|
|||||||
} // End namespace Test
|
} // End namespace Test
|
||||||
|
|
||||||
// TODO: define operator<< for std::tuple.
|
// 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.
|
// 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.
|
// Suite setup/teardown functions should allocate/free.
|
||||||
// Test setup/teardown functions should consume the data allocated by suite setup.
|
// 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.
|
// Test setup functions may allocate additional resources. If they do then the allocated resources they should be
|
||||||
// Suite and/or test compare functions may consume this shared data, but it will not be shared with the execution of function_to_test.
|
// 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__
|
#endif // End !defined TEST_H__
|
||||||
|
|||||||
Reference in New Issue
Block a user