Giter VIP home page Giter VIP logo

tddec-code's People

Contributors

chrisoldwood avatar jwgrenning avatar keith-at-spacee avatar pvag avatar yatesco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tddec-code's Issues

different instructions are needed to set up Docker in Windows

When running from a Windows cmd.exe command line, slightly modified settings are needed to set the environment variables and use these when kicking off Docker. I found the following to work in Windows. It assumes you have pulled the sources into folder C:\Users\YourName\tddec-code.

set PWD=/c/Users/YourName
set MOUNT_DIR=%PWD%:/usr/src
set WORKING_DIR=/usr/src/tddec-code
set CPPUTEST_HOME=%WORKING_DIR%/cpputest

Check things out with a bash invocation as follows:
C:\Users\YourName>docker run -it -v %MOUNT_DIR% -w %WORKING_DIR% -e CPPUTEST_HOME gcc:7 /bin/bash

then do the usual things like make etc.

make and make clean

Maybe obvious but...

Running make in tddec-code builds cpputest. Is required in order to build the rest of the code in the sub folders. Executing make clean in tddec-code removes cpputest and it will not longer be possible to build the code in the sub folders. Running make clean in sub folders does not touch cpputest.

Thank's for a great book!

build from clone unintuitive and insufficiently documented

After cloning the repo, and attempting to enter tddec-code/code to begin build, mutliple errors and warnings are immediately obstructive. A basic installation of cpputest using apt-get will not satisfy the build dependences for tddec-code/code/MakefileCppUtest.mk.

The first issue includes setting to the CPPUTEST_HOME, and results in:
MakefileCppUTest.mk:60: /build/MakefileWorker.mk: No such file or directory

However, I may be mistaken, but I don't see a clear indication in the tddec book that this is where CPPUTEST_HOME should be set. In fact, even the online cpputest documentation is quite unclear on what value CPPUTEST_HOME should have.

Once the user determines that CPPUTEST_HOME should be set, not to an install directory available from the apt package cpputest, but only from the cpputest source, then they encounter a new link in the error chain, seen here:

cpputest/cpputest#991

Thank you

Compile warning fix

On compile in the /code/ directory with a newer compiler you will get:

compiling DvRecorder.c
src/dvr/DvRecorder.c: In function ‘DvRecorder_RestorePrograms’:
src/dvr/DvRecorder.c:39:1: error: C++ style comments are not allowed in ISO C90 [-Werror]
// programs = programs;
^
src/dvr/DvRecorder.c:39:1: error: (this will be reported only once per input file) [-Werror]
cc1: all warnings being treated as errors
make[1]: *** [objs/src/dvr/DvRecorder.o] Error 1
make[1]: Leaving directory `/home/dmiller/scratch/tddec-code/code'
make: *** [all] Error 2

Changing from C++ style comments to C style fixes.

⟫ gcc --version
gcc (Ubuntu 4.8.2-19ubuntu1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.

diff --git a/code/src/dvr/DvRecorder.c b/code/src/dvr/DvRecorder.c
index db06bb1..2ad9745 100644
--- a/code/src/dvr/DvRecorder.c
+++ b/code/src/dvr/DvRecorder.c
@@ -36,7 +36,7 @@ void DvrRecorder_Create(void)

void DvRecorder_RestorePrograms(DvRecorder * programs)
{
-// programs = programs;
+/* programs = programs;*/
}

void DvRecorder_Destroy(void)

docker install instructions

They refer to $MYPROJECTS and then later to $PWD and $WORKING_DIR. Are these all different directories? Or should $PWD and $WORKING_DIR be $MYPROJECTS?

Proper folder before executing docker run

The Docker setup instructions can include a little text about proper starting folder before the docker run command.

Example. Say you cloned to folder tddec-code, and you are in folder ~/github,. Then the ttd code is in folder ~/github/tddec-code. While you are in ~/github execute:

WORKING_DIR=/usr/src/tddec-code
export CPPUTEST_HOME=$WORKING_DIR/cpputest
docker run -it  -v $MOUNT_DIR -w $WORKING_DIR -e CPPUTEST_HOME gcc:7 make

IGNORE_TEST counting using unity.framework doesn't work

I am follwing the book Test-Driven Development for Embedded C to learn about TDD. Recently I come across the usage of IGNORE_TEST, which is based on unity.framework, the test case is quite simple, just the same as the code shown in the end of Section 4.1(I am using the Chinese version).

#include "unity_fixture.h"
TEST_GROUP_RUNNER(LedDriver)
{
	RUN_TEST_CASE(LedDriver, LedsOffAfterCreate);
	RUN_TEST_CASE(LedDriver, TurnOnLedOne);
	RUN_TEST_CASE(LedDriver, TurnOffLedOne);
	RUN_TEST_CASE(LedDriver, TurnOnMultipleLeds);
	RUN_TEST_CASE(LedDriver, AllOn);
	RUN_TEST_CASE(LedDriver, TurnOffAnyLed);
	RUN_TEST_CASE(LedDriver, LedMemoryIsNotReadable);
	RUN_TEST_CASE(LedDriver, UpperAndLowerBounds);
	RUN_TEST_CASE(LedDriver, OutOfBoundsTurnOnDoesNoHarm);
	RUN_TEST_CASE(LedDriver, OutOfBoundsTurnOffDoesNoHarm);
	RUN_TEST_CASE(LedDriver, OutOfBoundsProducesRuntimeError);
	RUN_TEST_CASE(LedDriver, OutOfBoundsToDo);
}

here is the output of the original code:
1516717473 1
you can see that the ignore test case was marked but not counted.

I have search the net to figure out the reason, and I check the source code of unity atThrowTheSwitch/Unity, at line 120, the code is different from code here, after I change it:

    //Unity.CurrentTestIgnored = 1;
	Unity.TestIgnores ++;

It worked and I get the right ignored test count number. So I think may be there is something wrong.

Environment variable CPPUTEST_HOME not working in some of the files when using docker

cpputest_home_issue

In the first line where I run make in code-t2 I was initially getting an error of no directory found. At the bottom of the makefile in this directory there was an include $(CPPUTEST_HOME)/build/MakefileWorker.mk and it seemed that the CPPUTEST_HOME was not working properly. Just to test it out I replaced $(CPPUTEST_HOME) with ../cpputest/ and it worked but now it seems that the CPPUTEST_HOME gets called again to search for other files such as MemoryLeakDetectorNewMacros.h and as a result it won't build the tests.

This seems to be similar to pull request #9 but not sure what it can be.

Libtoolize error

Not sure where to post this, but found this spot. I can move it somewhere else if you like.
I have cloned the tddec-code into c:\TDD\tddec-code on Windows 10. Started the build and received this error.
Any suggestions?
image

error on make without docker - solution here for the ones in need

If you follow the local installation instructions as in: "If you want to try without docker, you might run into the problem of moving targets for CppUTest, gcc and clang."
You will ran into a make error.
tddec-code/Makefile requires the cpputest to be in tddec-code/cpputest

following the git clone instructions solves the problem:

MYPROJECTS=myprojects
mkdir -p $MYPROJECTS
cd $MYPROJECTS
git clone --recurse-submodules https://github.com/jwgrenning/tddec-code.git

WORKING_DIR=$MYPROJECTS/tddec-code
export CPPUTEST_HOME=$WORKING_DIR/cpputest
cd $WORKING_DIR
make

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.