From 7d956c533e9fd7d3bbb9a4a8b7f89f0fe54d4bc3 Mon Sep 17 00:00:00 2001 From: Thomas Schmucker Date: Sun, 13 Apr 2025 22:43:46 +0200 Subject: first draft --- tests/.clang-format | 45 +++++++++++++++++++++++++++++++++++++++++++++ tests/.clang-tidy | 19 +++++++++++++++++++ tests/compile_flags.txt | 8 ++++++++ tests/config.mk | 3 +++ tests/makefile | 24 ++++++++++++++++++++++++ 5 files changed, 99 insertions(+) create mode 100644 tests/.clang-format create mode 100644 tests/.clang-tidy create mode 100644 tests/compile_flags.txt create mode 100644 tests/config.mk (limited to 'tests') diff --git a/tests/.clang-format b/tests/.clang-format new file mode 100644 index 0000000..b32bad6 --- /dev/null +++ b/tests/.clang-format @@ -0,0 +1,45 @@ +--- +AccessModifierOffset: -4 +AlignConsecutiveAssignments: 'true' +AlignConsecutiveDeclarations: 'true' +AlignEscapedNewlines: Left +AlignTrailingComments: 'true' +AlwaysBreakAfterReturnType: TopLevelDefinitions +BreakBeforeBraces: Stroustrup +BreakConstructorInitializers: BeforeComma +BreakInheritanceList: BeforeComma +ColumnLimit: '0' +CompactNamespaces: 'false' +Cpp11BracedListStyle: 'false' +FixNamespaceComments: 'true' +IncludeBlocks: Regroup +IncludeCategories: + - Regex: '^.*(precomp|pch|stdafx)' + Priority: -1 + - Regex: '^<.*>' + Priority: 1 + - Regex: '^".*"' + Priority: 2 + - Regex: '.*' + Priority: 3 +IndentCaseLabels: 'false' +IndentPPDirectives: AfterHash +IndentWidth: '4' +IndentWrappedFunctionNames: 'false' +KeepEmptyLinesAtTheStartOfBlocks: 'false' +PointerAlignment: Right +SortIncludes: 'true' +SpaceAfterCStyleCast: 'true' +SpaceAfterTemplateKeyword: 'false' +SpaceBeforeAssignmentOperators: 'true' +SpaceBeforeParens: ControlStatements +SpaceBeforeRangeBasedForLoopColon: 'false' +SpaceInEmptyParentheses: 'false' +SpacesInAngles: 'false' +SpacesInCStyleCastParentheses: 'false' +SpacesInConditionalStatement: 'true' +SpacesInParentheses: 'false' +Standard: Auto +TabWidth: '4' +UseTab: ForIndentation +... diff --git a/tests/.clang-tidy b/tests/.clang-tidy new file mode 100644 index 0000000..0bceb5b --- /dev/null +++ b/tests/.clang-tidy @@ -0,0 +1,19 @@ +--- +Checks: "*, + -abseil-*, + -altera-*, + -android-*, + -fuchsia-*, + -google-*, + -llvm*, + -modernize-use-trailing-return-type, + -zircon-*, + -readability-else-after-return, + -readability-static-accessed-through-instance, + -readability-avoid-const-params-in-decls, + -cppcoreguidelines-non-private-member-variables-in-classes, + -misc-non-private-member-variables-in-classes, +" +WarningsAsErrors: '' +HeaderFilterRegex: '' +FormatStyle: none diff --git a/tests/compile_flags.txt b/tests/compile_flags.txt new file mode 100644 index 0000000..9352ecc --- /dev/null +++ b/tests/compile_flags.txt @@ -0,0 +1,8 @@ +-Wall +-Wextra +-Wsign-compare +-Wsign-conversion +-pedantic +-std=c99 +-O2 +-I../lib/include diff --git a/tests/config.mk b/tests/config.mk new file mode 100644 index 0000000..4b51d37 --- /dev/null +++ b/tests/config.mk @@ -0,0 +1,3 @@ +BUILD_DIR=../build +CFLAGS=-Wall -Wextra -Wsign-compare -Wsign-conversion -pedantic -std=c99 -O2 -I../lib/include +LDFLAGS=-L$(BUILD_DIR) -lcsv diff --git a/tests/makefile b/tests/makefile index e69de29..2300a19 100644 --- a/tests/makefile +++ b/tests/makefile @@ -0,0 +1,24 @@ +include config.mk + +TEST_RUNNER=$(BUILD_DIR)/tester +OBJS=$(BUILD_DIR)/csv-test.o + +$(TEST_RUNNER): $(OBJS) | libcsv + cc -o $@ $(LDFLAGS) $(OBJS) + +$(BUILD_DIR)/%.o: src/%.c | $(BUILD_DIR) + cc $(CFLAGS) -c $< -o $@ + +$(BUILD_DIR): + mkdir -p $@ + +.PHONY: libcsv +libcsv: + $(MAKE) -C ../lib + +compile_flags.txt: + echo "$(CFLAGS)" | tr ' ' '\n' > $@ + +.PHONY: clean +clean: + rm -f $(TEST_RUNNER) $(OBJS) -- cgit v1.3