Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .gitHooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# availabilty of python
py=$(which py || which python || which python3)
if [[ -z $py ]]
then
then
echo "No python found"
exit 0
fi
Expand All @@ -15,22 +15,22 @@ cd $(git rev-parse --show-toplevel)
# path to sompy python scripts
sompy=$(pwd)/submodules/sompy/somutil

# files regarded as text files to be cleaned
txts=
# extensions of text files sorted by likeliness
xtxt="h cpp cmd py md lua sh yml"
# files to skip
skips="make/*"

txts=()

for file in $(git diff-index --cached --name-only HEAD); do
if [[ -f $file ]]
then
for ext in $xtxt; do
if [[ $file == *.$ext ]]; then txts="$txts $file"; break; fi
if [ -f $file ]; then
ok=true
for s in $skips; do
if [[ $file == $s ]]; then ok=false; break; fi
done
if $ok; then txts+=($file); fi
fi
done

if [[ -n $txts ]]; then
echo cleaning text files
$py $sompy/cleanTxt.py -l $txts
fi
for file in $txts; do git add $file; done
echo txt: ${#txts[@]}
done=$($py $sompy/cleanTxt.py -le ${txts[@]})

for file in $done; do git add $file; done
2 changes: 1 addition & 1 deletion .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
uses: actions/checkout@v3

- name: ci
run: cd make; chmod +x ci.sh; ./ci.sh
run: cd scripts; chmod +x ci.sh; ./ci.sh
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ MON.*
*.log
tmp*
*.ctc
vs

# python
*.pyc
__pycache__

# Prerequisites
*.d
Expand Down Expand Up @@ -50,4 +55,3 @@ tmp*
*.exe
*.out
*.app

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ C++ code collection to evaluate coverage tools
- headers
- sources
- test execution code
- [make and run section](make/README.md) for Bullseye and CTC++
- [make and run section](scripts/README.md) for Bullseye and CTC++
31 changes: 10 additions & 21 deletions code/CoverageMacro.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,30 @@
#define COVERAGE_MACRO_H

#include <coding.h>
#include <coverage.h>

#define MODULE_TEST
#define MAX(V1, V2) (((V1) > (V2)) ? (V1) : (V2))

// private members and public getters
// private members, public getters and setters
#define MEMBER(TYPE, NAME, VAL) \
private: TYPE m ## NAME = VAL; \
public: inline TYPE get ## NAME() const { return m ## NAME; }

// in module test also public setters
#ifdef MODULE_TEST
#define SETTER(TYPE, NAME) \
public: inline void set ## NAME(const TYPE val) { m ## NAME = val; }
#else
#define SETTER(TYPE, NAME)
#endif
public: \
inline TYPE get ## NAME() const { return m ## NAME; } \
inline void set ## NAME(const TYPE val) { m ## NAME = val; }

class CoverageMacro
{
public:
INSTANCE_DEC(CoverageMacro)

inline CoverageMacro(int i1=1, int i2=2):
mInt(MAX(i1, i2))
{}

// members and getters
MEMBER(bool, Bool1, false)
MEMBER(int, Int1, 11)

// test code setters: no coverage
BULLSEY_PAUSE
#pragma CTC SKIP

SETTER(bool, Bool1)
SETTER(int, Int1)

#pragma CTC ENDSKIP
BULLSEY_RESUME
const int mInt;
};

#endif // _H
53 changes: 53 additions & 0 deletions code/CoverageMcpp.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,57 @@ class CoverageMcpp
const SomeStruct mStruct;
};

template <bool B, int I>
class CoverageInline
{
public:
CoverageInline() = delete;
inline static bool isNeg() { return IsNeg or I < 0; }
inline static int val() { return IsNeg ? Val : -Val; }
inline static bool func()
{
if constexpr (I < 0)
{
return true;
}
else
{
return false;
}
}

private:
// static const bool and
const static bool IsNeg = B and I < 0;
// static const int ternary
const static int Val = IsNeg ? I : -I;
};

template <bool B, int I>
class CoverageConstExpr
{
public:
CoverageConstExpr() = delete;
constexpr static bool isNeg() { return IsNeg or I < 0; }
constexpr static int val() { return IsNeg ? Val : -Val; }
constexpr static bool func()
{
if constexpr (I < 0)
{
return true;
}
else
{
return false;
}
}
private:
// static const bool and
constexpr static bool IsNeg = B and I < 0;
// static const int ternary
constexpr static int Val = IsNeg ? I : -I;
};



#endif // _H
14 changes: 11 additions & 3 deletions code/CoverageTpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,24 @@ class CoverageTpl
#define MAX(V1, V2) (((V1) > (V2)) ? (V1) : (V2))

template <typename T1, typename T2>
class ByteBuffer
class ByteBufferHeap
{
public:
inline ByteBuffer():
inline ByteBufferHeap():
mBytes(new unsigned char[MAX(sizeof(T1), sizeof(T2))])
{}
inline ~ByteBuffer() { delete[] mBytes; }
inline ~ByteBufferHeap() { delete[] mBytes; }
private:
unsigned char* mBytes;
};

template <typename T1, typename T2>
class ByteBufferStack
{
public:
inline ByteBufferStack() = default;
private:
unsigned char mBytes[MAX(sizeof(T1), sizeof(T2))];
};

#endif // _H
32 changes: 0 additions & 32 deletions make/Bullseye_msbuild.cmd

This file was deleted.

30 changes: 0 additions & 30 deletions make/CTC_msbuild.cmd

This file was deleted.

37 changes: 23 additions & 14 deletions make/Makefile
Original file line number Diff line number Diff line change
@@ -1,29 +1,30 @@
# Alternative GNU Make workspace makefile autogenerated by Premake
# GNU Make workspace makefile autogenerated by Premake

ifndef config
config=ci
config=release
endif

ifndef verbose
SILENT = @
endif

ifeq ($(config),ci)
Test_Standard_config = ci
Test_Standard_Part_config = ci
Test_B_Macro_config = ci
Test_Count_config = ci
Test_Exclude_config = ci
Test_FD_SET_Macro_config = ci
Test_Macro_config = ci
Test_Mod_Cpp_config = ci
testlib_config = ci
ifeq ($(config),release)
Test_Standard_config = release
Test_Standard_Part_config = release
Test_B_Macro_config = release
Test_Count_config = release
Test_Exclude_config = release
Test_FD_SET_Macro_config = release
Test_Macro_config = release
Test_Mod_Cpp_config = release
Test_All_config = release
testlib_config = release

else
$(error "invalid configuration $(config)")
endif

PROJECTS := Test_Standard Test_Standard_Part Test_B_Macro Test_Count Test_Exclude Test_FD_SET_Macro Test_Macro Test_Mod_Cpp testlib
PROJECTS := Test_Standard Test_Standard_Part Test_B_Macro Test_Count Test_Exclude Test_FD_SET_Macro Test_Macro Test_Mod_Cpp Test_All testlib

.PHONY: all clean help $(PROJECTS)

Expand Down Expand Up @@ -77,6 +78,12 @@ ifneq (,$(Test_Mod_Cpp_config))
@${MAKE} --no-print-directory -C . -f Test_Mod_Cpp.make config=$(Test_Mod_Cpp_config)
endif

Test_All: testlib
ifneq (,$(Test_All_config))
@echo "==== Building Test_All ($(Test_All_config)) ===="
@${MAKE} --no-print-directory -C . -f Test_All.make config=$(Test_All_config)
endif

testlib:
ifneq (,$(testlib_config))
@echo "==== Building testlib ($(testlib_config)) ===="
Expand All @@ -92,13 +99,14 @@ clean:
@${MAKE} --no-print-directory -C . -f Test_FD_SET_Macro.make clean
@${MAKE} --no-print-directory -C . -f Test_Macro.make clean
@${MAKE} --no-print-directory -C . -f Test_Mod_Cpp.make clean
@${MAKE} --no-print-directory -C . -f Test_All.make clean
@${MAKE} --no-print-directory -C . -f testlib.make clean

help:
@echo "Usage: make [config=name] [target]"
@echo ""
@echo "CONFIGURATIONS:"
@echo " ci"
@echo " release"
@echo ""
@echo "TARGETS:"
@echo " all (default)"
Expand All @@ -111,6 +119,7 @@ help:
@echo " Test_FD_SET_Macro"
@echo " Test_Macro"
@echo " Test_Mod_Cpp"
@echo " Test_All"
@echo " testlib"
@echo ""
@echo "For more information, see https://github.com/premake/premake-core/wiki"
29 changes: 0 additions & 29 deletions make/README.md

This file was deleted.

Loading