chore: migrate project into clean repository

This commit is contained in:
yuuux
2026-08-13 16:50:52 +08:00
commit d1d25a09e7
27405 changed files with 9422808 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
#Set this to @ to keep the makefile quiet
SILENCE = @
#---- Outputs ----#
COMPONENT_NAME = Project
TARGET_LIB = \
lib/lib$(COMPONENT_NAME).a
TEST_TARGET = \
$(COMPONENT_NAME)_tests
#--- Inputs ----#
PROJECT_HOME_DIR = .
CPPUTEST_HOME = ../CppUTest
CPPUNIT_HOME = ../cppunit
CPP_PLATFORM = Gcc
#CFLAGS are set to override malloc and free to get memory leak detection in C programs
CFLAGS = -Dmalloc=cpputest_malloc -Dfree=cpputest_free
CPPFLAGS =
#GCOVFLAGS = -fprofile-arcs -ftest-coverage
#SRC_DIRS is a list of source directories that make up the target library
#If test files are in these directories, their IMPORT_TEST_GROUPs need
#to be included in main to force them to be linked in. By convention
#put them into an AllTests.h file in each directory
SRC_DIRS = \
src/util
#TEST_SRC_DIRS is a list of directories including
# - A test main (AllTests.cpp by convention)
# - OBJ files in these directories are included in the TEST_TARGET
# - Consequently - AllTests.h containing the IMPORT_TEST_GROUPS is not needed
# -
TEST_SRC_DIRS = \
tests \
tests/util
#includes for all compiles
INCLUDES =\
-I.\
-Iinclude/util\
-I$(CPPUTEST_HOME)/include/
#Flags to pass to ld
LDFLAGS += $(CPPUNIT_HOME)/lib/libcppunit.a
include $(CPPUTEST_HOME)/build/ComponentMakefile

View File

@@ -0,0 +1,28 @@
#ifndef D_ProjectBuildTime_H
#define D_ProjectBuildTime_H
///////////////////////////////////////////////////////////////////////////////
//
// ProjectBuildTime is responsible for recording and reporting when
// this project library was built
//
///////////////////////////////////////////////////////////////////////////////
class ProjectBuildTime
{
public:
explicit ProjectBuildTime();
virtual ~ProjectBuildTime();
const char* GetDateTime();
private:
const char* dateTime;
ProjectBuildTime(const ProjectBuildTime&);
ProjectBuildTime& operator=(const ProjectBuildTime&);
};
#endif // D_ProjectBuildTime_H

View File

@@ -0,0 +1,16 @@
#include "ProjectBuildTime.h"
ProjectBuildTime::ProjectBuildTime()
: dateTime(__DATE__ " " __TIME__)
{
}
ProjectBuildTime::~ProjectBuildTime()
{
}
const char* ProjectBuildTime::GetDateTime()
{
return dateTime;
}

View File

@@ -0,0 +1,8 @@
#include "CppUTest/CommandLineTestRunner.h"
int main(int ac, char** av)
{
return CommandLineTestRunner::RunAllTests(ac, av);
}

View File

@@ -0,0 +1,22 @@
#include "CppUTest/TestHarness.h"
#include "ProjectBuildTime.h"
TEST_GROUP(ProjectBuildTime)
{
ProjectBuildTime* projectBuildTime;
void setup()
{
projectBuildTime = new ProjectBuildTime();
}
void teardown()
{
delete projectBuildTime;
}
};
TEST(ProjectBuildTime, Create)
{
CHECK(0 != projectBuildTime->GetDateTime());
}