Merge pull request #425 from ThrowTheSwitch/cmock_2_6_rc

CMock 2.6 Release Candidate
This commit is contained in:
Mark VanderVoord
2025-01-01 12:16:21 -05:00
committed by GitHub
212 changed files with 3019 additions and 634 deletions
+13 -8
View File
@@ -15,16 +15,14 @@ jobs:
unit-tests:
name: "Unit Tests"
runs-on: ubuntu-latest
strategy:
matrix:
ruby: ['3.0', '3.1', '3.2', '3.3']
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches
# Install Multilib
- name: Install Multilib
run: |
sudo apt-get update --assume-yes
sudo apt-get update -qq
sudo apt-get install --assume-yes --quiet gcc-multilib
# Checks out repository under $GITHUB_WORKSPACE
@@ -33,12 +31,19 @@ jobs:
with:
submodules: recursive
# Setup Ruby Testing Tools to do tests on multiple ruby version
- name: Setup Ruby Testing Tools
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
# Install Ruby Testing Tools
- name: Setup Ruby Testing Tools
run: |
sudo gem install bundler
sudo gem install rspec
sudo gem install rubocop -v 0.57.2
sudo gem install rubocop -v 1.57.2
sudo gem install bundler
bundle update
bundle install
# Run Tests
-7
View File
@@ -1,8 +1 @@
source "http://rubygems.org/"
gem "bundler"
gem "rake"
gem "minitest"
gem "require_all"
gem "constructor"
gem "diy"
+3 -1
View File
@@ -1,4 +1,6 @@
Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
The MIT License (MIT)
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+27 -11
View File
@@ -1,5 +1,6 @@
CMock ![CI](https://github.com/ThrowTheSwitch/CMock/workflows/CI/badge.svg)
=====
CMock is a mock and stub generator and runtime for unit testing C. It's been designed
to work smoothly with Unity Test, another of the embedded-software testing tools
developed by ThrowTheSwitch.org. CMock automagically parses your C headers and creates
@@ -8,30 +9,45 @@ useful and usable mock interfaces for unit testing. Give it a try!
If you don't care to manage unit testing builds yourself, consider checking out Ceedling,
a test-centered build manager for unit testing C code.
Getting Started
================
- [Known Issues](docs/CMockKnownIssues.md)
- [Change Log](docs/CMockChangeLog.md)
If you're using Ceedling, there is no need to install CMock. It will handle it for you.
For everyone else, the simplest way is to grab it off github. You can also download it
as a zip if you prefer. The Github method looks something like this:
Getting Started
===============
Your first step is to get yourself a copy of CMock. There are a number of ways to do this:
1. If you're using Ceedling, there is no need to install CMock. It will handle it for you.
2. The simplest way is to grab it off github. The Github method looks something like this:
> git clone --recursive https://github.com/throwtheswitch/cmock.git
> cd cmock
> bundle install # Ensures you have all RubyGems needed
3. You can also grab the `zip` file from github. If you do this, you'll also need to grab yourself a
copy of Unity and CException, because github unfortunately doesn't bake dependencies into the zip
files.
Contributing to this Project
============================
If you plan to help with the development of CMock (or just want to verify that it can
perform its self tests on your system) then you can enter the test directory and then
ask it to test:
perform its self tests on your system) then you can grab its self-testing dependencies,
then run its self-tests:
> cd cmock
> bundle install # Ensures you have all RubyGems needed
> cd test
> rake # Run all CMock self tests
> rake # Run all CMock self tests
Before working on this project, you're going to want to read our guidelines on
[contributing](docs/CONTRIBUTING.md).
API Documentation
=================
* Not sure what you're doing?
* [View docs/CMock_Summary.md](docs/CMock_Summary.md)
* Interested in our MIT-style license?
* Interested in our MIT license?
* [View docs/license.txt](LICENSE.txt)
* Are there examples?
* They are all in [/examples](examples/)
+34
View File
@@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-
$LOAD_PATH << File.expand_path(File.join(File.dirname(__FILE__), 'lib'))
require "lib/cmock_version"
require 'date'
Gem::Specification.new do |s|
s.name = "cmock"
s.version = CMockVersion::GEM
s.platform = Gem::Platform::RUBY
s.authors = ["Mark VanderVoord", "Michael Karlesky", "Greg Williams"]
s.email = ["mark@vandervoord.net", "michael@karlesky.net", "barney.williams@gmail.com"]
s.homepage = "http://throwtheswitch.org/cmock"
s.summary = "CMock is a mocking framework for C unit testing. It's a member of the ThrowTheSwitch.org family of tools."
s.description = <<-DESC
CMock is a mocking framework for C unit testing. It accepts header files and generates mocks automagically for you.
DESC
s.licenses = ['MIT']
s.metadata = {
"homepage_uri" => s.homepage,
"bug_tracker_uri" => "https://github.com/ThrowTheSwitch/CMock/issues",
"documentation_uri" => "https://github.com/ThrowTheSwitch/CMock/blob/master/docs/CMock_Summary.md",
"mailing_list_uri" => "https://groups.google.com/forum/#!categories/throwtheswitch/cmock",
"source_code_uri" => "https://github.com/ThrowTheSwitch/CMock"
}
s.required_ruby_version = ">= 3.0.0"
s.files += Dir['**/*']
s.test_files = Dir['test/**/*']
s.executables = ['lib/cmock.rb']
s.require_paths = ["lib"]
end
+7 -6
View File
@@ -1,12 +1,13 @@
# ==========================================
# CMock Project - Automatic Mock Generation for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# CMock - Automatic Mock Generation for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
# Setup our load path:
[
'lib'
].each do |dir|
$:.unshift(File.join(__dir__ + '/../', dir))
$:.unshift(File.join("#{__dir__}//..//", dir))
end
+7 -6
View File
@@ -1,8 +1,9 @@
# ==========================================
# CMock Project - Automatic Mock Generation for C
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
# [Released under MIT License. Please refer to license.txt for details]
# ==========================================
# =========================================================================
# CMock - Automatic Mock Generation for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
# Setup our load path:
[
@@ -12,5 +13,5 @@
'./vendor/unity/auto/',
'./test/system/'
].each do |dir|
$:.unshift(File.join(File.expand_path(File.dirname(__FILE__) + '/../'), dir))
$:.unshift(File.join(File.expand_path("#{File.dirname(__FILE__)}//..//"), dir))
end
+166
View File
@@ -0,0 +1,166 @@
# CMock - Change Log
## A Note
This document captures significant features and fixes to the CMock project core source files
and scripts. More detail can be found in the history on Github.
This project is now tracking changes in more detail. Previous releases get less detailed as
we move back in histroy.
Prior to 2012, the project was hosted on SourceForge.net
Prior to 2008, the project was an internal project and not released to the public.
## Log
### CMock 2.6.0 (January 2025)
New Features:
- Reintroduced option to run CMock without setjmp (slightly limited)
- Significant speed improvements to parsing
Significant Bugfixes:
- Make return-thru-pointer calls const
- Fix handling of static inlines
- Fix some situations where parenthetical statements were misinterpreted as functions
- Fix error in skeleton creation
- Improvements towards making generated code fully C-compliant and warning free
Other:
- Improve error message wording where possible
- Improve documentation
- Updated to Ruby 3.0 - 3.3
- Reintroduce matrix testing across multiple Ruby versions
### CMock 2.5.3 (January 2021)
New Features:
- Support mocks in sub-folders
- Improved handling of static and inline functions
- Stateless Ignore plugin added
Significant Bugfixes:
- Allow setting values to empty at command prompt
- Improvements towards making generated code fully C-compliant and warning free
Other:
- Really basic mocking of cpp files (like C files with extern C)
### CMock 2.5.2 (May 2020)
Significant Bugfixes:
- Fix whitespace errors
- Fix Stop Ignore
### CMock 2.5.1 (April 2020)
New Features:
- Add StopIgnore function to Ignore Plugin
- Add ability to generate skeleton from a header.
- Inline functions now have option to remove and mock (with Ceedling's help)
Significant Bugfixes:
- Convert internal handling of bools to chars from ints for memory savings
- Convert CMOCK_MEM_INDEX_TYPE default type to size_t
- Switch to old-school comments for supporting old C compilers
- Significant improvements to handling array length expressions
- Significant improvements to our "C parser"
- Added brace-pair counting to improve parsing
- Fixed error when `:unity_helper_path` is relative
Other:
- Improve documentation
- Optimize speed for pass case, particularly in `_verify()` functions
- Increased depth of unit and system tests
### CMock 2.5.0 (October 2019)
New Features:
- New memory bounds checking.
- New memory alignment algorithm.
- Add `ExpectAnyArgs` plugin
- Divided `CVallback` from `Stub` functionality so we can do both.
- Improved wording of failure messages.
- Added `:treat_as_array` configuration option
Significant Bugfixes:
- Fixed bug where `CMock_Guts_MemBytesUsed()` didn't always return `0` before usage
- Fixed bug which sometimes got `CMOCK_MEM_ALIGN` wrong
- Fixed bug where `ExpectAnyArgs` was generated for functions without args.
- Better handling of function pointers
Other:
- `void*` now tested as bytewise array comparison.
- Documentation fixes, particularly to examples.
- Added `resetTest` to documentation
- New handling of messaging to greatly reduce memory footprint
### CMock 2.4.6 (November 2017)
Significant Bugfixes:
- Fixed critical bug when running dynamic memory.
### CMock 2.4.5 (September 2017)
New Features:
- Simple threading of mocks introduced.
Significant Bugfixes:
- Improvements to handling pointer const arguments.
- Treat `char*` separately from an array of bytes.
- Fixed handling of string arguments.
- Preserve `const` in all arguments.
- Fixed race condition when `require`ing plugins
Other:
- Expand docs on `strict_mock_calling`
### CMock 2.4.4 (April 2017)
New Features:
- Add `INCLUDE_PATH` option for specifying source
Significant Bugfixes:
- Parsing improvements related to braces, brackets, and parenthesis
- `ReturnThruPtr` checks destination not null before copying data.
- Stub overrides Ignore
- Improvements to guessing memory alignment based on datatypes
Other:
- Reorganize testing into subdirectory to not clutter for new users
- Docs switching to markdown from pdf
### CMock 2.4.3 (October 2016)
New Features:
- Support multiple helper header files.
- Add ability to use `weak` symbols if compiler supports it
- Add mock suffix option in addition to mock prefix.
Significant Bugfixes:
- Improved UNICODE support
+13
View File
@@ -0,0 +1,13 @@
# CMock - Known Issues
## A Note
This project will do its best to keep track of significant bugs that might effect your usage of this
project and its supporting scripts. A more detailed and up-to-date list for cutting edge CMock can
be found on our Github repository.
## Issues
- Able to parse most C header files without preprocessor needs, but when handling headers with significant preprocessor usage (#ifdefs, etc), it can get confused
- Multi-dimensional arrays currently simplified to single dimensional arrays of the full size
- Incomplete support for VarArgs
+274
View File
@@ -0,0 +1,274 @@
CMock: Argument Validation
==========================
Much of the power of CMock comes from its ability to automatically
validate that the arguments passed to mocked functions are the
values that were expected to be passed. CMock puts a lot of effort
into guessing how the user would most like to see those values
compared, and then represented when failures are encountered.
Like Unity, CMock follows a philosophy of making its best guesses,
and then allowing the user to explicity specify any features that
they would like to change or customize.
Option 1: Common Types
----------------------
First, if you're dealing with C's standard types, there is nothing
further you need to do. CMock will choose an appropriate assertion
from Unity's list of assertions and will perform the comparison and
display using that. For example, if you specify a `short`, then it's
very likely CMock will compare using `TEST_ASSERT_EQUAL_INT16`. For
unsigned values, it assumes you'd like them displayed in hex. Are you
interested in comparing a `const char*`? That would be Unity's
string comparison.
What if you have some other type of pointer? If you've instructed
CMock to compare pointers, it'll use `TEST_ASSERT_EQUAL_PTR`.
Otherwise it'll use dereference the value being pointed at and
compare that for you. (Read more about the Array plugin for more
details on how this all works). The TYPE being pointed to follows the
same rules as the those above... so if they're common types, for example
`unsigned char*`, then CMock will choose to compare using the
logical assertion (in this case `TEST_ASSERT_EQUAL_HEX8`).
A quick note about floating point types: we're calling the assertions
`TEST_ASSERT_EQUAL_FLOAT` (for example), but don't worry... these
assertions are actually checking to make sure that the values are
"incredibly close" to the desired value instead of identical. This
is because many numbers can be represented in multiple ways when
using floating point. These differences are out of the control of
the user, for the most part. You can ready more about this in the
Unity documentation if you're interested in the details.
Option 1b: The Fallback Plan
----------------------------
So what happens when CMock doesn't recognize the type being used?
This will happen for any custom types being used. What constitutes
a custom type?
- You've used `#define` to create an alias for a standard type
- You've used `typedef` to create an alias for a standard type
- You've created an `enum` type
- You've created a `union` type
- You've created a `struct` type
- You're working with a function pointer
When CMock doesn't recognize the type as a standard type, (and
assuming you don't have a better option specified, as any of the
options below), it will fall back to performing a memory
comparison using `TEST_ASSERT_EQUAL_MEMORY`. For the most part,
this is effective, but the reported failures are not terribly
descriptive.
**WARNING:** There is one important instance where this fallback method
doesn't work at all. If the custom type is a `struct` and that
struct isn't packed, then it's possible you can get false failures
when the unused bytes between fields differ. For an unpacked struct,
it's important that you either use option 3 or 4 below, or ignore that
particular argument (and possibly test it manually yourself).
Option 2: Treat-As
------------------
CMock maintains a list of non-standard types which are basically
aliases of standard types. For example, a common shorthand for
a single-byte unsigned integer might be `u8` or `U8` or `UNIT8`.
Any of these can simply be mapped to the standard
`TEST_ASSERT_EQUAL_HEX8`.
While CMock has its own list of `:treat_as` mappings, you can
add your own pairings to this list. This works especially well for
the following types:
- aliases of standard types using `#define` or `typedef`
- `enum` types (works well as `INT8` or whatever size your enums are)
- function pointers often work well as `PTR` comparisons
- `union` types sometimes make sense to treat as the largest type...
but this is a judgement call
Option 3: Custom Assertions for Custom Types
--------------------------------------------
CMock has the ability to use custom assertions, if you form them
according to certain specifications. Creating a custom assertion
can be a bit of work, But the reward is that, once you've done so,
you can use those assertions within your own tests AND CMock will
magically use them within its own mocks.
To accomplish this, we're going tackle multiple steps:
1. Write a custom assertion function
2. Wrap it in a `UNITY_TEST_` macro
3. Wrap it in a `TEST_` macro
4. Inform CMock that it exists
Let's look at each of those steps in detail:
### Creating a Custom Assertion
A custom assertion is a function which accepts a standard set of
inputs, and then uses Unity's assertion macros to verify any details
required for the types involved.
The inputs:
- the `expected` value (as a `const` version of type being verified)
- the `actual` value (also as a `const` version of the desired type)
- the `line` this function was called from (as type `UNITY_LINE_TYPE`)
- an optional `message` to be appended (as type `const char*`)
Inside the function, we use the *internal* versions of Unity's assertions
to validate any details that need validating.
Let's look at an example! Let's say we have the following type:
```
typedef struct MyType_t
{
int a;
const char* b;
} MyType;
```
In our application, the length of `b` is supposed to be specified by `a`,
and `b` is therefore allowed to have any value (including `0x00`).
Our custom assertion might look something like this:
```
void AssertEqualMyType(const MyType expected, const MyType actual, UNITY_LINE_TYPE line, const char* message)
{
//It's common to override the default message with our own
(void)message;
// Verify the lengths are the same, or they're clearly not matched
UNITY_TEST_ASSERT_EQUAL_INT(expected.a, actual.a, line, "Data length mismatch");
// Verify we're dealing with actual pointers
UNITY_TEST_ASSERT_NOT_NULL(expected.b, line, "Expected value should not be NULL");
UNITY_TEST_ASSERT_NOT_NULL(actual.b, line, "Actual value should not be NULL");
// Verify the string contents
UNITY_TEST_ASSERT_EQUAL_MEMORY(expected.b, actual.b, expected.a, line, "Data not equal");
}
```
There are a few things to note about this. First, notice we're using the
`UNITY_TEST_ASSERT_` assertions? That's because these allow us to pass
on the specific line number. Second, notice we override the message with our
own more helpful messages? You don't need to do this, but anything you can do
to help a developer find a bug is a good thing.
What if there isn't an assertion that is right for your needs? You can
always do whatever operations are necessary yourself, and use `UNITY_TEST_FAIL()`
directly.
One final note: It's best to only test the things that are hard rules about
how a type is supposed to work in your system. Anything else should be left to
the test code.
For example, let's say that in our example above, there are situations where
it IS valid for the pointers to be `NULL`. Perhaps the pointers are ignored
completely when the `a` field is `0`. In that case, we could drop those
assertions completely, or add logic to only check when necessary.
Similarly, should our assertion check that the length is positive? In this
case, it's dangerous if it's negative, because the memory check wouldn't like it.
Updating for these concerns:
```
void AssertEqualMyType(const MyType expected, const MyType actual, UNITY_LINE_TYPE line, const char* message)
{
//It's common to override the default message with our own
(void)message;
// Verify the lengths are the same, or they're clearly not matched
UNITY_TEST_ASSERT_EQUAL_INT(expected.a, actual.a, line, "Data length mismatch");
// Verify the lengths are non-negative
UNITY_TEST_ASSERT_GREATER_OR_EQUAL_INT(0, expected.a, line, "Data length must be positive");
if (expected.a > 0)
{
// Verify we're dealing with actual pointers
UNITY_TEST_ASSERT_NOT_NULL(expected.b, line, "Expected value should not be NULL");
UNITY_TEST_ASSERT_NOT_NULL(actual.b, line, "Actual value should not be NULL");
// Verify the string contents
UNITY_TEST_ASSERT_EQUAL_MEMORY(expected.b, actual.b, expected.a, line, "Data not equal");
}
}
```
### Wrapping our Assertion in Macros
Once you have a function which does the main work, we *need* to create
one macro, and there are a number of other macros which are useful to
create, in order to treat our assertion just like any other Unity
assertion.
`#define UNITY_TEST_ASSERT_EQUAL_MyType(e,a,l,m) AssertEqualMyType(e,a,l,m)`
The macro above is the one that CMock is looking for. Notice that it
starts with `UNITY_TEST_ASSERT_EQUAL_` followed by the name of our type,
*exactly* the way our type is named. The arguments are, in order:
- `e` - expected value
- `a` - actual value
- `l` - line number to report
- `m` - message to append at the end
If CMock finds a macro that matches this argument list and naming convention,
then it can automatically use this assertion where needed... all we need to
do now is tell CMock where to find our custom assertion.
### Informing CMock about our Assertion
In the CMock configuration file, in the `:cmock` or `:unity` sections,
there can be an option for `unity_helper_path`. Add the location of your
new Unity helper file (file with this assertion) to this list.
Done!
**Bonus:** Once you've created a custom assertion, you can use it
with `:treat_as`, just like any other standard type! This is
particularly useful when there is a custom type which is a pointer
to a custom type.
For example, let's say you have these types:
```
typedef struct MY_STRUCT_T_
{
int a;
const char* b;
} MY_STRUCT_T;
typedef MY_STRUCT_T* MY_STRUCT_POINTER_T;
```
Also, let's assume you've created the following assertion:
```
UNITY_TEST_ASSERT_EQUAL_MY_STRUCT_T(e,a,l,m)
```
You can use `:treat_as` like so:
```
:treat_as:
MY_STRUCT_POINTER_T: MY_STRUCT_T*
```
Option 4: Callback
------------------
Finally, You can choose to avoid the use of `_Expect` calls altogether
for challenging types, and use a `Callback` instead. The advantage is that
you can fill in whichever assertions make sense for that particular test,
instead of needing to rely on reusable assertions as used elsewhere.
Typically, this option is also less work than option 3.
+14 -5
View File
@@ -1,10 +1,13 @@
CMock: A Summary
================
*[ThrowTheSwitch.org](http://throwtheswitch.org)*
*[ThrowTheSwitch.org](http://throwtheswitch.org)*
*This documentation is released under a Creative Commons 3.0 Attribution Share-Alike License*
- [Known Issues](docs/CMockKnownIssues.md)
- [Change Log](docs/CMockChangeLog.md)
- [How Does CMock Validate Arguments](docs/CMock_ArgumentValidation.md)
What Exactly Are We Talking About Here?
---------------------------------------
@@ -61,7 +64,7 @@ call DoesSomething enough, or too much, or with the wrong arguments,
or in the wrong order.
CMock is based on Unity, which it uses for all internal testing.
It uses Ruby to do all the main work (versions 2.0.0 and above).
It uses Ruby to do all the main work (versions 3.0.0 and above).
Installing
@@ -77,7 +80,7 @@ have it. You can prove it by typing the following:
If it replied in a way that implies ignorance, then you're going to
need to install it. You can go to [ruby-lang](https://ruby-lang.org)
to get the latest version. You're also going to need to do that if it
replied with a version that is older than 2.0.0. Go ahead. We'll wait.
replied with a version that is older than 3.0.0. Go ahead. We'll wait.
Once you have Ruby, you have three options:
@@ -608,17 +611,19 @@ from the defaults. We've tried to specify what the defaults are below.
- "static inline"
- "inline static"
- "inline"
- "static"
You can override these patterns, check out :inline_function_patterns.
Enabling this feature does require a change in the build system that
is using CMock. To understand why, we need to give some more info
on how we are handling inline functions internally.
Let's say we want to mock a header called example.h. example.h
contains inline functions, we cannot include this header in the
mocks or test code if we want to mock the inline functions simply
because the inline functions contain an implementation that we want
to override in our mocks!
So, to circumvent this, we generate a new header, also named
example.h, in the same directory as mock_example.h/c . This newly
generated header should/is exactly the same as the original header,
@@ -626,11 +631,13 @@ from the defaults. We've tried to specify what the defaults are below.
functions declarations. Placing the new header in the same
directory as mock_example.h/c ensures that they will include the new
header and not the old one.
However, CMock has no control in how the build system is configured
and which include paths the test code is compiled with. In order
for the test code to also see the newly generated header ,and not
the old header with inline functions, the build system has to add
the mock folder to the include paths.
Furthermore, we need to keep the order of include paths in mind. We
have to set the mock folder before the other includes to avoid the
test code including the original header instead of the newly
@@ -812,7 +819,8 @@ and start over clean. This is really useful when wanting to test a function in
an iterative manner with different arguments.
C++ Support
---------
-----------
C++ unit test/mocking frameworks often use a completely different approach (vs.
CMock) that relies on overloading virtual class members and does not support
directly mocking static class member methods or free functions (i.e., functions
@@ -847,6 +855,7 @@ Will generate functions like
void MyNamespace_MyClass_DoesSomething_ExpectAndReturn(int a, int b, int toReturn);
Examples
========
+138
View File
@@ -0,0 +1,138 @@
# ThrowTheSwitch.org Code of Conduct
Thank you for participating in a ThrowTheSwitch.org community project! We want
this to continue to be a warm and inviting place for everyone to share ideas
and get help. To accomplish this goal, we've developed this Code of Conduct.
## Our Pledge
We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.
We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.
## Our Standards
Examples of behavior that contributes to a positive environment for our
community include:
* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community
Examples of unacceptable behavior include:
* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Enforcement Responsibilities
Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.
Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.
## Scope
This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
hello@thingamabyte.com.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
reporter of any incident.
## Enforcement Guidelines
Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:
### 1. Correction
**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.
**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.
### 2. Warning
**Community Impact**: A violation through a single incident or series of
actions.
**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.
### 3. Temporary Ban
**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.
**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.
### 4. Permanent Ban
**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.
**Consequence**: A permanent ban from any sort of public interaction within the
community.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].
[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
+238
View File
@@ -0,0 +1,238 @@
# Contributing to a ThrowTheSwitch.org Project
👍🎉 _First off, thanks for taking the time to contribute!_ 🎉👍
The following is a set of guidelines for contributing to any of ThrowTheSwitch.org's projects or the website itself, hosted at throwtheswitch.org or ThrowTheSwitch's organization on GitHub. These are mostly guidelines, not rules. Use your best judgment, and feel free to propose changes to this document in a pull request.
### Table Of Contents
- [Code of Conduct](#book-code-of-conduct)
- [Asking Questions](#bulb-asking-questions)
- [Opening an Issue](#inbox_tray-opening-an-issue)
- [Feature Requests](#love_letter-feature-requests)
- [Triaging Issues](#mag-triaging-issues)
- [Submitting Pull Requests](#repeat-submitting-pull-requests)
- [Writing Commit Messages](#memo-writing-commit-messages)
- [Code Review](#white_check_mark-code-review)
- [Coding Style](#nail_care-coding-style)
- [Certificate of Origin](#medal_sports-certificate-of-origin)
- [Credits](#pray-credits)
## :book: Code of Conduct
Please review our [Code of Conduct](CODE_OF_CONDUCT.md). It is in effect at all times. We expect it to be honored by everyone who contributes to this project. Be a Good Human!
## :bulb: Asking Questions
> **Note:** Please don't file an issue to ask a question. We have an official forum where the community chimes in with helpful advice if you have questions.
* [ThrowTheSwitch Forums](https://throwtheswitch.org/forums)
### What should I know before I get started?
ThrowTheSwitch hosts a number of open source projects &mdash; Ceedling is the entrypoint for many users. Ceedling is actually built upon the foundation of Unity Test (a flexible C testing framework) and CMock (a mocking tool for C) and it coordinates many other open source and proprietary tools. Please do your best to focus your ideas and questions at the correct tool. We'll do our best to help you find your way, but there will be times where we'll have to direct your attention to another subtool.
Here are some of the main projects hosted by ThrowTheSwitch.org:
- [Ceedling](https://www.github.com/throwtheswitch/ceedling) -- Build coordinator for testing C applications, especially embedded C (and optionally your release build too!)
- [CMock](https://www.github.com/throwtheswitch/cmock) -- Mocking tool for automatically creating stubs, mocks, and skeletons in C
- [Unity](https://www.github.com/throwtheswitch/unity) -- Unit Testing framework for C, specially embedded C.
- [MadScienceLabDocker](https://www.github.com/throwtheswitch/madsciencelabdocker) -- Docker image giving you a shortcut to getting running with Ceedling
- [CException](https://www.github.com/throwtheswitch/cexception) -- An exception framework for using simple exceptions in C.
There are many more, but this list should be a good starting point.
## :inbox_tray: Opening an Issue
Before [creating an issue](https://help.github.com/en/github/managing-your-work-on-github/creating-an-issue), check if you are using the latest version of the project. If you are not up-to-date, see if updating fixes your issue first.
### :beetle: Bug Reports and Other Issues
A great way to contribute to the project is to send a detailed issue when you encounter a problem. We always appreciate a well-written, thorough bug report. :v:
In short, since you are most likely a developer, **provide a ticket that you would like to receive**.
- **Review the documentation** before opening a new issue.
- **Do not open a duplicate issue!** Search through existing issues to see if your issue has previously been reported. If your issue exists, comment with any additional information you have. You may simply note "I have this problem too", which helps prioritize the most common problems and requests.
- **Prefer using [reactions](https://github.blog/2016-03-10-add-reactions-to-pull-requests-issues-and-comments/)**, not comments, if you simply want to "+1" an existing issue.
- **Fully complete the provided issue template.** The bug report template requests all the information we need to quickly and efficiently address your issue. Be clear, concise, and descriptive. Provide as much information as you can, including steps to reproduce, stack traces, compiler errors, library versions, OS versions, and screenshots (if applicable).
- **Use [GitHub-flavored Markdown](https://help.github.com/en/github/writing-on-github/basic-writing-and-formatting-syntax).** Especially put code blocks and console outputs in backticks (```). This improves readability.
## :seedling: Feature Requests
Feature requests are welcome! We don't have all the answers and we truly love the collaborative experience of building software together! That being said, we cannot guarantee your request will be accepted. We want to avoid [feature creep](https://en.wikipedia.org/wiki/Feature_creep). Your idea may be great, but also out-of-scope for the project. If accepted, we'll do our best to tackle it in a timely manner, but cannot make any commitments regarding the timeline for implementation and release. However, you are welcome to submit a pull request to help!
- **Please don't open a duplicate feature request.** Search for existing feature requests first. If you find your feature (or one very similar) previously requested, comment on that issue.
- **Fully complete the provided issue template.** The feature request template asks for all necessary information for us to begin a productive conversation.
- Be precise about the proposed outcome of the feature and how it relates to existing features. Include implementation details if possible.
## :mag: Triaging Issues
You can triage issues which may include reproducing bug reports or asking for additional information, such as version numbers or reproduction instructions. Any help you can provide to quickly resolve an issue is very much appreciated!
## :repeat: Submitting Pull Requests
We **love** pull requests! Before [forking the repo](https://help.github.com/en/github/getting-started-with-github/fork-a-repo) and [creating a pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/proposing-changes-to-your-work-with-pull-requests) for non-trivial changes, it is usually best to first open an issue to discuss the changes, or discuss your intended approach for solving the problem in the comments for an existing issue.
For most contributions, after your first pull request is accepted and merged, you will be [invited to the project](https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/inviting-collaborators-to-a-personal-repository) and given **push access**. :tada:
*Note: All contributions will be licensed under the project's license.*
- **Smaller is better.** Submit **one** pull request per bug fix or feature. A pull request should contain isolated changes pertaining to a single bug fix or feature implementation. **Do not** refactor or reformat code that is unrelated to your change. It is better to **submit many small pull requests** rather than a single large one. Enormous pull requests will take enormous amounts of time to review, or may be rejected altogether.
- **Coordinate bigger changes.** For large and non-trivial changes, open an issue to discuss a strategy with the maintainers. Otherwise, you risk doing a lot of work for nothing!
- **Prioritize understanding over cleverness.** Write code clearly and concisely. Remember that source code usually gets written once and read often. Ensure the code is clear to the reader. The purpose and logic should be obvious to a reasonably skilled developer, otherwise you should add a comment that explains it.
- **Follow existing coding style and conventions.** Keep your code consistent with the style, formatting, and conventions in the rest of the code base. When possible, these will be enforced with a linter. Consistency makes it easier to review and modify in the future.
- **Include test coverage.** Add unit tests when possible. Follow existing patterns for implementing tests.
- **Update the example project** if one exists to exercise any new functionality you have added.
- **Add documentation.** Document your changes with code doc comments or in existing guides.
- **Update the CHANGELOG** for all enhancements and bug fixes. Include the corresponding issue number if one exists, and your GitHub username. (example: "- Fixed crash in profile view. #123 @jessesquires")
- **Use the repo's default branch.** Branch from and [submit your pull request](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork) to the repo's default branch. Usually this is `main`, but it could be `dev`, `develop`, or `master`.
- **[Resolve any merge conflicts](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/resolving-a-merge-conflict-on-github)** that occur.
- **Promptly address any CI failures**. If your pull request fails to build or pass tests, please push another commit to fix it.
- When writing comments, use properly constructed sentences, including punctuation.
- Use spaces, not tabs.
## :memo: Writing Commit Messages
Please [write a great commit message](https://chris.beams.io/posts/git-commit/).
1. Separate subject from body with a blank line
1. Limit the subject line to 50 characters
1. Capitalize the subject line
1. Do not end the subject line with a period
1. Wrap the body at _about_ 72 characters
1. Use the body to explain **why**, *not what and how* (the code shows that!)
1. If applicable, prefix the title with the relevant component name or emoji (see below. examples: "[Docs] Fix typo", "[Profile] Fix missing avatar")
```
:palm_tree: Summary of Amazing Feature Here
Add a more detailed explanation here, if necessary. Possibly give
some background about the issue being fixed, etc. The body of the
commit message can be several paragraphs. Further paragraphs come
after blank lines and please do proper word-wrap.
Wrap it to about 72 characters or so. In some contexts,
the first line is treated as the subject of the commit and the
rest of the text as the body. The blank line separating the summary
from the body is critical (unless you omit the body entirely);
various tools like `log`, `shortlog` and `rebase` can get confused
if you run the two together.
Explain the problem that this commit is solving. Focus on why you
are making this change as opposed to how or what. The code explains
how or what. Reviewers and your future self can read the patch,
but might not understand why a particular solution was implemented.
Are there side effects or other unintuitive consequences of this
change? Here's the place to explain them.
- Bullet points are awesome, too
- A hyphen should be used for the bullet, preceded
by a single space, with blank lines in between
Note the fixed or relevant GitHub issues at the end:
Resolves: #123
See also: #456, #789
```
## :heart: Who Loves Emoji?
Commit comments, Issues, Feature Requests... they can all use a little sprucing up, right? Consider using the following emoji for a mix of function and :sparkles: dazzle!
- actions
- :seedling: `:seedling:` (or other plants) when growing new features. Choose your fav! :cactus: :herb: :evergreen_tree: :palm_tree: :deciduous_tree: :blossom:
- :art: `:art:` when improving the format/structure of the code
- :racehorse: `:racehorse:` when improving performance
- :non-potable_water: `:non-potable_water:` when plugging memory leaks
- :memo: `:memo:` when writing docs
- :bug: `:bug:` (or other insects) when fixing a bug. Maybe :beetle: :ant: or :honeybee: ?
- :fire: `:fire:` when removing code or files
- :green_heart: `:green_heart:` when fixing the CI build
- :white_check_mark: `:white_check_mark:` when adding tests
- :lock: `:lock:` when dealing with security
- :arrow_up: `:arrow_up:` when upgrading dependencies
- :arrow_down: `:arrow_down:` when downgrading dependencies
- :shirt: `:shirt:` when removing linter warnings
- platforms
- :penguin: `:penguin:` when fixing something on Linux
- :apple: `:apple:` when fixing something on macOS
- :checkered_flag: `:checkered_flag:` when fixing something on Windows
## :white_check_mark: Code Review
- **Review the code, not the author.** Look for and suggest improvements without disparaging or insulting the author. Provide actionable feedback and explain your reasoning.
- **You are not your code.** When your code is critiqued, questioned, or constructively criticized, remember that you are not your code. Do not take code review personally.
- **Always do your best.** No one writes bugs on purpose. Do your best, and learn from your mistakes.
- Kindly note any violations to the guidelines specified in this document.
## :violin: Coding Style
Consistency is the most important. Following the existing style, formatting, and naming conventions of the file you are modifying and of the overall project. Failure to do so will result in a prolonged review process that has to focus on updating the superficial aspects of your code, rather than improving its functionality and performance.
For example, if all private properties are prefixed with an underscore `_`, then new ones you add should be prefixed in the same way. Or, if methods are named using camelcase, like `thisIsMyNewMethod`, then do not diverge from that by writing `this_is_my_new_method`. You get the idea. If in doubt, please ask or search the codebase for something similar.
When possible, style and format will be enforced with a linter.
### C Styleguide
C code is linted with [AStyle](https://astyle.sourceforge.net/).
### Ruby Styleguide
Ruby code is linted with [Rubocop](https://github.com/rubocop/rubocop)
## :medal_sports: Certificate of Origin
*Developer's Certificate of Origin 1.1*
By making a contribution to this project, I certify that:
> 1. The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
> 1. The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
> 1. The contribution was provided directly to me by some other person who certified (1), (2) or (3) and I have not modified it.
> 1. I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.
## [No Brown M&M's](https://en.wikipedia.org/wiki/Van_Halen#Contract_riders)
If you are reading this, bravo dear user and (hopefully) contributor for making it this far! You are awesome. :100:
To confirm that you have read this guide and are following it as best as possible, **include this emoji at the top** of your issue or pull request: :pineapple: `:pineapple:`
## :pray: Credits
Written by [@jessesquires](https://github.com/jessesquires). Lovingly adapted to ThrowTheSwitch.org by [@mvandervoord](https://github.com/mvandervoord).
**Please feel free to adopt this guide in your own projects. Fork it wholesale or remix it for your needs.**
*Many of the ideas and prose for the statements in this document were based on or inspired by work from the following communities:*
- [Alamofire](https://github.com/Alamofire/Alamofire/blob/master/CONTRIBUTING.md)
- [CocoaPods](https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md)
- [Docker](https://github.com/moby/moby/blob/master/CONTRIBUTING.md)
- [Linux](https://elinux.org/Developer_Certificate_Of_Origin)
*We commend them for their efforts to facilitate collaboration in their projects.*
+1 -1
View File
@@ -23,7 +23,7 @@ ${BUILD_DIR}/main: ${SRC_DIR}/main.c ${SRC_DIR}/foo.c
${CC} $< -o $@
run:
./build/main || true
./build/main
test: setup
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "foo.h"
void foo_init(void)
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _foo_h
void foo_init(void);
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include <stdio.h>
#include "foo.h"
+8 -1
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "foo.h"
@@ -13,5 +20,5 @@ void test_foo_init_should_initialize_multiplier()
{
foo_init();
TEST_ASSERT_FALSE(1);
TEST_ASSERT_FALSE(0);
}
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "mock_foo.h"
-44
View File
@@ -1,44 +0,0 @@
compiler:
path: gcc
source_path: 'src/'
unit_tests_path: &unit_tests_path 'test/'
build_path: &build_path 'build/'
options:
- -c
includes:
prefix: '-I'
items:
- 'src/'
- '../../src/'
- '../../vendor/unity/src/'
- '../../vendor/unity/examples/example_3/helper/'
- './build/mocks/'
- *unit_tests_path
defines:
prefix: '-D'
items:
- __monitor
object_files:
prefix: '-o'
extension: '.o'
destination: *build_path
linker:
path: gcc
options:
- -lm
includes:
prefix: '-I'
object_files:
path: *build_path
extension: '.o'
bin_files:
prefix: '-o'
extension: '.exe'
destination: *build_path
:cmock:
:plugins: []
:includes:
- Types.h
:mock_path: ./build/mocks
colour: true
-92
View File
@@ -1,92 +0,0 @@
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\'
compiler:
path: [*tools_root, 'arm\bin\iccarm.exe']
source_path: 'src\'
unit_tests_path: &unit_tests_path 'test\'
build_path: &build_path 'build\'
options:
- --dlib_config
- [*tools_root, 'arm\lib\dl4tptinl8n.h']
- -z3
- --no_cse
- --no_unroll
- --no_inline
- --no_code_motion
- --no_tbaa
- --no_clustering
- --no_scheduling
- --debug
- --cpu_mode thumb
- --endian little
- --cpu ARM7TDMI
- --stack_align 4
- --interwork
- -e
- --silent
- --warnings_are_errors
- --fpu None
- --diag_suppress Pa050
includes:
prefix: '-I'
items:
- 'src/'
- '../../src/'
- '../../vendor/unity/src/'
- '../../vendor/unity/examples/example_3/helper/'
- './build/mocks/'
- [*tools_root, 'arm\inc\']
- *unit_tests_path
defines:
prefix: '-D'
items:
object_files:
prefix: '-o'
extension: '.r79'
destination: *build_path
linker:
path: [*tools_root, 'common\bin\xlink.exe']
options:
- -rt
- [*tools_root, 'arm\lib\dl4tptinl8n.r79']
- -D_L_EXTMEM_START=0
- -D_L_EXTMEM_SIZE=0
- -D_L_HEAP_SIZE=120
- -D_L_STACK_SIZE=32
- -e_small_write=_formatted_write
- -s
- __program_start
- -f
- [*tools_root, '\arm\config\lnkarm.xcl']
includes:
prefix: '-I'
items:
- [*tools_root, 'arm\config\']
- [*tools_root, 'arm\lib\']
object_files:
path: *build_path
extension: '.r79'
bin_files:
prefix: '-o'
extension: '.d79'
destination: *build_path
simulator:
path: [*tools_root, 'common\bin\CSpyBat.exe']
pre_support:
- --silent
- [*tools_root, 'arm\bin\armproc.dll']
- [*tools_root, 'arm\bin\armsim.dll']
post_support:
- --plugin
- [*tools_root, 'arm\bin\armbat.dll']
- --backend
- -B
- -p
- [*tools_root, 'arm\config\ioat91sam7X256.ddf']
- -d
- sim
:cmock:
:plugins: []
:includes:
- Types.h
:mock_path: ./build/mocks
-81
View File
@@ -1,81 +0,0 @@
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
compiler:
path: [*tools_root, 'arm\bin\iccarm.exe']
source_path: 'src\'
unit_tests_path: &unit_tests_path 'test\'
build_path: &build_path 'build\'
options:
- --dlib_config
- [*tools_root, 'arm\inc\DLib_Config_Normal.h']
- --no_cse
- --no_unroll
- --no_inline
- --no_code_motion
- --no_tbaa
- --no_clustering
- --no_scheduling
- --debug
- --cpu_mode thumb
- --endian=little
- --cpu=ARM7TDMI
- --interwork
- --warnings_are_errors
- --fpu=None
- --diag_suppress=Pa050
- --diag_suppress=Pe111
- -e
- -On
includes:
prefix: '-I'
items:
- 'src/'
- '../../src/'
- '../../vendor/unity/src/'
- '../../vendor/unity/examples/example_3/helper/'
- './build/mocks/'
- [*tools_root, 'arm\inc\']
- *unit_tests_path
defines:
prefix: '-D'
items:
object_files:
prefix: '-o'
extension: '.r79'
destination: *build_path
linker:
path: [*tools_root, 'arm\bin\ilinkarm.exe']
options:
- --redirect _Printf=_PrintfLarge
- --redirect _Scanf=_ScanfSmall
- --semihosting
- --entry __iar_program_start
- --config
- [*tools_root, 'arm\config\generic.icf']
object_files:
path: *build_path
extension: '.o'
bin_files:
prefix: '-o'
extension: '.out'
destination: *build_path
simulator:
path: [*tools_root, 'common\bin\CSpyBat.exe']
pre_support:
- --silent
- [*tools_root, 'arm\bin\armproc.dll']
- [*tools_root, 'arm\bin\armsim.dll']
post_support:
- --plugin
- [*tools_root, 'arm\bin\armbat.dll']
- --backend
- -B
- -p
- [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf']
- -d
- sim
:cmock:
:plugins: []
:includes:
- Types.h
:mock_path: ./build/mocks
+8 -1
View File
@@ -1,4 +1,11 @@
HERE = __dir__ + '/'
# =========================================================================
# CMock - Automatic Mock Generation for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
HERE = "#{__dir__}//".freeze
require 'rake'
require 'rake/clean'
+33 -21
View File
@@ -1,3 +1,10 @@
# =========================================================================
# CMock - Automatic Mock Generation for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
require 'yaml'
require 'fileutils'
require '../../vendor/unity/auto/unity_test_summary'
@@ -9,14 +16,20 @@ module RakefileHelpers
C_EXTENSION = '.c'.freeze
def load_yaml(yaml_string)
YAML.load(yaml_string, aliases: true)
rescue ArgumentError
YAML.load(yaml_string)
end
def load_configuration(config_file)
$cfg_file = config_file
$cfg = YAML.load(File.read($cfg_file))
$cfg = load_yaml(File.read("./targets/#{$cfg_file}"))
$colour_output = false unless $cfg['colour']
end
def configure_clean
CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil?
CLEAN.include("#{$cfg['compiler']['build_path']}*.*") unless $cfg['compiler']['build_path'].nil?
end
def configure_toolchain(config_file = DEFAULT_CONFIG_FILE)
@@ -26,7 +39,7 @@ module RakefileHelpers
end
def unit_test_files
path = $cfg['compiler']['unit_tests_path'] + 'Test*' + C_EXTENSION
path = $cfg['compiler']['unit_tests_path'] + "Test*#{C_EXTENSION}"
path.tr!('\\', '/')
FileList.new(path)
end
@@ -41,7 +54,7 @@ module RakefileHelpers
includes = []
lines = File.readlines(filename)
lines.each do |line|
m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/)
m = line.match(/^\s*#include\s+"\s*(.+\.[hH])\s*"/)
unless m.nil?
includes << m[1]
end
@@ -87,7 +100,7 @@ module RakefileHelpers
end
options = squash('', $cfg['compiler']['options'])
includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
includes = includes.gsub(/\\ /, ' ').gsub(/\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
{ :command => command, :defines => defines, :options => options, :includes => includes }
end
@@ -112,17 +125,17 @@ module RakefileHelpers
else
squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items'])
end
includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
includes = includes.gsub(/\\ /, ' ').gsub(/\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
{ :command => command, :options => options, :includes => includes }
end
def link_it(exe_name, obj_list)
linker = build_linker_fields
cmd_str = "#{linker[:command]}#{linker[:includes]} " +
(obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj} " }).join +
$cfg['linker']['bin_files']['prefix'] + ' ' +
$cfg['linker']['bin_files']['destination'] +
exe_name + $cfg['linker']['bin_files']['extension'] + " #{linker[:options]}"
cmd_str = "#{linker[:command]}#{linker[:includes]} " \
"#{(obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj} " }).join}" \
"#{$cfg['linker']['bin_files']['prefix']} " \
"#{$cfg['linker']['bin_files']['destination']}" \
"#{exe_name}#{$cfg['linker']['bin_files']['extension']} #{linker[:options]}"
execute(cmd_str)
end
@@ -132,7 +145,7 @@ module RakefileHelpers
command = if $cfg['simulator']['path'].nil?
''
else
(tackit($cfg['simulator']['path']) + ' ')
"#{tackit($cfg['simulator']['path'])} "
end
pre_support = if $cfg['simulator']['pre_support'].nil?
''
@@ -182,20 +195,19 @@ module RakefileHelpers
# Build and execute each unit test
test_files.each do |test|
obj_list = []
# Detect dependencies and build required required modules
header_list = (extract_headers(test) + ['cmock.h'] + [$cfg[:cmock][:unity_helper_path]]).compact.uniq
header_list.each do |header|
# create mocks if needed
next unless header =~ /Mock/
require '../../lib/cmock.rb'
@cmock ||= CMock.new($cfg_file)
require '../../lib/cmock'
@cmock ||= CMock.new(".//targets//#{$cfg_file}")
@cmock.setup_mocks([$cfg['compiler']['source_path'] + header.gsub('Mock', '')])
end
# compile all mocks
obj_list = []
header_list.each do |header|
# compile source file header if it exists
src_file = find_source_file(header, include_dirs)
@@ -206,10 +218,10 @@ module RakefileHelpers
# Build the test runner (generate if configured to do so)
test_base = File.basename(test, C_EXTENSION)
runner_name = test_base + '_Runner.c'
runner_name = "#{test_base}_Runner.c"
if $cfg['compiler']['runner_path'].nil?
runner_path = $cfg['compiler']['build_path'] + runner_name
test_gen = UnityTestRunnerGenerator.new($cfg_file)
runner_path = "#{$cfg['compiler']['build_path']}#{runner_name}"
test_gen = UnityTestRunnerGenerator.new(".//targets//#{$cfg_file}")
test_gen.run(test, runner_path)
else
runner_path = $cfg['compiler']['runner_path'] + runner_name
@@ -231,7 +243,7 @@ module RakefileHelpers
else
"#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
end
output = execute(cmd_str, true, true)
output = execute(cmd_str, true)
test_results = $cfg['compiler']['build_path'] + test_base
test_results += if output.match(/OK$/m).nil?
'.testfail'
@@ -246,7 +258,7 @@ module RakefileHelpers
report 'Building application...'
obj_list = []
load_configuration($cfg_file)
load_configuration(".//targets//#{$cfg_file}")
main_path = $cfg['compiler']['source_path'] + main + C_EXTENSION
# Detect dependencies and build required required modules
+20 -12
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
// ----------------------------------------------------------------------------
// ATMEL Microcontroller Software Support - ROUSSET -
// ----------------------------------------------------------------------------
@@ -45,15 +52,16 @@
#define AT91SAM7X256_H
typedef volatile unsigned int AT91_REG;// Hardware register definition
typedef volatile void* AT91_PTR;// Hardware register pointer
// *****************************************************************************
// SOFTWARE API DEFINITION FOR System Peripherals
// *****************************************************************************
typedef struct _AT91S_SYS {
AT91_REG AIC_SMR[32]; // Source Mode Register
AT91_REG AIC_SVR[32]; // Source Vector Register
AT91_REG AIC_IVR; // IRQ Vector Register
AT91_REG AIC_FVR; // FIQ Vector Register
AT91_PTR AIC_SVR[32]; // Source Vector Register
AT91_PTR AIC_IVR; // IRQ Vector Register
AT91_PTR AIC_FVR; // FIQ Vector Register
AT91_REG AIC_ISR; // Interrupt Status Register
AT91_REG AIC_IPR; // Interrupt Pending Register
AT91_REG AIC_IMR; // Interrupt Mask Register
@@ -64,7 +72,7 @@ typedef struct _AT91S_SYS {
AT91_REG AIC_ICCR; // Interrupt Clear Command Register
AT91_REG AIC_ISCR; // Interrupt Set Command Register
AT91_REG AIC_EOICR; // End of Interrupt Command Register
AT91_REG AIC_SPU; // Spurious Vector Register
AT91_PTR AIC_SPU; // Spurious Vector Register
AT91_REG AIC_DCR; // Debug Control Register (Protect)
AT91_REG Reserved1[1]; //
AT91_REG AIC_FFER; // Fast Forcing Enable Register
@@ -214,9 +222,9 @@ typedef struct _AT91S_SYS {
// *****************************************************************************
typedef struct _AT91S_AIC {
AT91_REG AIC_SMR[32]; // Source Mode Register
AT91_REG AIC_SVR[32]; // Source Vector Register
AT91_REG AIC_IVR; // IRQ Vector Register
AT91_REG AIC_FVR; // FIQ Vector Register
AT91_PTR AIC_SVR[32]; // Source Vector Register
AT91_PTR AIC_IVR; // IRQ Vector Register
AT91_PTR AIC_FVR; // FIQ Vector Register
AT91_REG AIC_ISR; // Interrupt Status Register
AT91_REG AIC_IPR; // Interrupt Pending Register
AT91_REG AIC_IMR; // Interrupt Mask Register
@@ -227,7 +235,7 @@ typedef struct _AT91S_AIC {
AT91_REG AIC_ICCR; // Interrupt Clear Command Register
AT91_REG AIC_ISCR; // Interrupt Set Command Register
AT91_REG AIC_EOICR; // End of Interrupt Command Register
AT91_REG AIC_SPU; // Spurious Vector Register
AT91_PTR AIC_SPU; // Spurious Vector Register
AT91_REG AIC_DCR; // Debug Control Register (Protect)
AT91_REG Reserved1[1]; //
AT91_REG AIC_FFER; // Fast Forcing Enable Register
@@ -1727,14 +1735,14 @@ typedef struct _AT91S_ADC {
#define AT91C_AIC_EOICR ((AT91_REG *) 0xFFFFF130) // (AIC) End of Interrupt Command Register
#define AT91C_AIC_DCR ((AT91_REG *) 0xFFFFF138) // (AIC) Debug Control Register (Protect)
#define AT91C_AIC_FFER ((AT91_REG *) 0xFFFFF140) // (AIC) Fast Forcing Enable Register
#define AT91C_AIC_SVR ((AT91_REG *) 0xFFFFF080) // (AIC) Source Vector Register
#define AT91C_AIC_SPU ((AT91_REG *) 0xFFFFF134) // (AIC) Spurious Vector Register
#define AT91C_AIC_SVR ((AT91_PTR *) 0xFFFFF080) // (AIC) Source Vector Register
#define AT91C_AIC_SPU ((AT91_PTR *) 0xFFFFF134) // (AIC) Spurious Vector Register
#define AT91C_AIC_FFDR ((AT91_REG *) 0xFFFFF144) // (AIC) Fast Forcing Disable Register
#define AT91C_AIC_FVR ((AT91_REG *) 0xFFFFF104) // (AIC) FIQ Vector Register
#define AT91C_AIC_FVR ((AT91_PTR *) 0xFFFFF104) // (AIC) FIQ Vector Register
#define AT91C_AIC_FFSR ((AT91_REG *) 0xFFFFF148) // (AIC) Fast Forcing Status Register
#define AT91C_AIC_IMR ((AT91_REG *) 0xFFFFF110) // (AIC) Interrupt Mask Register
#define AT91C_AIC_ISR ((AT91_REG *) 0xFFFFF108) // (AIC) Interrupt Status Register
#define AT91C_AIC_IVR ((AT91_REG *) 0xFFFFF100) // (AIC) IRQ Vector Register
#define AT91C_AIC_IVR ((AT91_PTR *) 0xFFFFF100) // (AIC) IRQ Vector Register
#define AT91C_AIC_IDCR ((AT91_REG *) 0xFFFFF124) // (AIC) Interrupt Disable Command Register
#define AT91C_AIC_CISR ((AT91_REG *) 0xFFFFF114) // (AIC) Core Interrupt Status Register
#define AT91C_AIC_IPR ((AT91_REG *) 0xFFFFF10C) // (AIC) Interrupt Pending Register
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "AdcConductor.h"
#include "AdcModel.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _ADCCONDUCTOR_H
#define _ADCCONDUCTOR_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "AdcHardware.h"
#include "AdcHardwareConfigurator.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _ADCHARDWARE_H
#define _ADCHARDWARE_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "AdcHardwareConfigurator.h"
#include "ModelConfig.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _ADCHARDWARECONFIGURATOR_H
#define _ADCHARDWARECONFIGURATOR_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "AdcModel.h"
#include "TaskScheduler.h"
#include "TemperatureCalculator.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _ADCMODEL_H
#define _ADCMODEL_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "AdcTemperatureSensor.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _ADCTEMPERATURESENSOR_H
#define _ADCTEMPERATURESENSOR_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "Executor.h"
#include "Model.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _EXECUTOR_H
#define _EXECUTOR_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "IntrinsicsWrapper.h"
#ifdef __ICCARM__
#include <intrinsics.h>
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _INTRINSICS_WRAPPER_H
#define _INTRINSICS_WRAPPER_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "IntrinsicsWrapper.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _MAIN_H_
#define _MAIN_H_
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Model.h"
#include "TaskScheduler.h"
#include "TemperatureFilter.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _MODEL_H
#define _MODEL_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _MODELCONFIG_H
#define _MODELCONFIG_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "TaskScheduler.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _TASKSCHEDULER_H
#define _TASKSCHEDULER_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "TemperatureCalculator.h"
#include <math.h>
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _TEMPERATURECALCULATOR_H
#define _TEMPERATURECALCULATOR_H
+15 -5
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "TemperatureFilter.h"
#include <math.h>
@@ -27,13 +34,16 @@ void TemperatureFilter_ProcessInput(float temperature)
{
if (temperature == +INFINITY ||
temperature == -INFINITY ||
temperature == +NAN ||
temperature == -NAN)
temperature != temperature)
{
/* Check if +/- Infinity or NaN... reset to -Inf in this instance. */
initialized = FALSE;
temperature = -INFINITY;
temperatureInCelcius = -INFINITY;
}
else
{
/* Otherwise apply our low-pass filter to smooth the values */
temperatureInCelcius = (temperatureInCelcius * 0.75f) + (temperature * 0.25);
}
temperatureInCelcius = (temperatureInCelcius * 0.75f) + (temperature * 0.25);
}
}
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _TEMPERATUREFILTER_H
#define _TEMPERATUREFILTER_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "TimerConductor.h"
#include "TimerModel.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _TIMERCONDUCTOR_H
#define _TIMERCONDUCTOR_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "TimerConfigurator.h"
#include "TimerInterruptConfigurator.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _TIMERCONFIGURATOR_H
#define _TIMERCONFIGURATOR_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "TimerHardware.h"
#include "TimerConfigurator.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _TIMERHARDWARE_H
#define _TIMERHARDWARE_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "TimerInterruptConfigurator.h"
#include "TimerInterruptHandler.h"
@@ -36,7 +43,7 @@ void Timer_EnableInterrupt(void)
static inline void SetInterruptHandler(void)
{
AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (uint32)Timer_InterruptHandler;
AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = Timer_InterruptHandler;
}
static inline void ConfigureInterruptSourceModeRegister(void)
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _TIMERINTERRUPTCONFIGURATOR_H
#define _TIMERINTERRUPTCONFIGURATOR_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "TimerInterruptHandler.h"
#include "TimerInterruptConfigurator.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _TIMERINTERRUPTHANDLER_H
#define _TIMERINTERRUPTHANDLER_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "TimerModel.h"
#include "TaskScheduler.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _TIMERMODEL_H
#define _TIMERMODEL_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _MYTYPES_H_
#define _MYTYPES_H_
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "UsartBaudRateRegisterCalculator.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _USARTBAUDRATEREGISTERCALCULATOR_H
#define _USARTBAUDRATEREGISTERCALCULATOR_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "UsartConductor.h"
#include "UsartHardware.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _USARTCONDUCTOR_H
#define _USARTCONDUCTOR_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "UsartConfigurator.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _USARTCONFIGURATOR_H
#define _USARTCONFIGURATOR_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "UsartHardware.h"
#include "UsartConfigurator.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _USARTHARDWARE_H
#define _USARTHARDWARE_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "UsartModel.h"
#include "ModelConfig.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _USARTMODEL_H
#define _USARTMODEL_H
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "UsartPutChar.h"
#include "UsartTransmitBufferStatus.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _USARTPUT_HAR_H
#define _USARTPUT_HAR_H
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "Types.h"
#include "UsartTransmitBufferStatus.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#ifndef _USARTTRANSMITBUFFERSTATUS_H
#define _USARTTRANSMITBUFFERSTATUS_H
+97
View File
@@ -0,0 +1,97 @@
# =========================================================================
# CMock - Automatic Mock Generation for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
compiler:
path: gcc
source_path: 'src/'
unit_tests_path: &unit_tests_path 'test/'
build_path: &build_path 'build/'
options:
- -c
includes:
prefix: '-I'
items:
- 'src/'
- '../../src/'
- '../../vendor/unity/src/'
- '../../vendor/unity/examples/example_3/helper/'
- './build/mocks/'
- *unit_tests_path
defines:
prefix: '-D'
items:
- __monitor
- UNITY_SUPPORT_64
object_files:
prefix: '-o'
extension: '.o'
destination: *build_path
linker:
path: gcc
options:
- -lm
includes:
prefix: '-I'
object_files:
path: *build_path
extension: '.o'
bin_files:
prefix: '-o'
extension: '.exe'
destination: *build_path
:cmock:
# Core conffiguration
:plugins: [] # What plugins should be used by CMock?
:verbosity: 2 # the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose
:when_no_prototypes: :warn # the options being :ignore, :warn, or :erro
# File configuration
:mock_path: './build/mocks' # Subdirectory to store mocks when generated (default: mocks)
:skeleton_path: '' # Subdirectory to store stubs when generated (default: '')
:mock_prefix: 'Mock' # Prefix to append to filenames for mocks
:mock_suffix: '' # Suffix to append to filenames for mocks
# Parser configuration
:strippables: ['(?:__attribute__\s*\([ (]*.*?[ )]*\)+)']
:attributes:
- __ramfunc
- __irq
- __fiq
- register
- extern
:c_calling_conventions:
- __stdcall
- __cdecl
- __fastcall
:treat_externs: :exclude # the options being :include or :exclud
:treat_inlines: :exclude # the options being :include or :exclud
# Type handling configuration
#:unity_helper_path: '' # specify a string of where to find a unity_helper.h file to discover custom type assertions
#:treat_as: {} # optionally add additional types to map custom types
#:treat_as_array: {} # hint to cmock that these types are pointers to something
#:treat_as_void: [] # hint to cmock that these types are actually aliases of void
:memcmp_if_unknown: true # allow cmock to use the memory comparison assertions for unknown types
:when_ptr: :compare_data # hint to cmock how to handle pointers in general, the options being :compare_ptr, :compare_data, or :smart
# Mock generation configuration
:weak: '' # Symbol to use to declare weak functions
:enforce_strict_ordering: false # Do we want cmock to enforce ordering of all function calls?
:fail_on_unexpected_calls: true # Do we want cmock to fail when it encounters a function call that wasn't expected?
:callback_include_count: true # Do we want cmock to include the number of calls to this callback, when using callbacks?
:callback_after_arg_check: false # Do we want cmock to enforce an argument check first when using a callback?
:includes: # You can add additional includes here, or specify the location with the options below
- Types.h
#:includes_h_pre_orig_header: []
#:includes_h_post_orig_header: []
#:includes_c_pre_header: []
#:includes_c_post_header: []
#:array_size_type: [] # Specify a type or types that should be used for array lengths
#:array_size_name: 'size|len' # Specify a name or names that CMock might automatically recognize as the length of an array
:exclude_setjmp_h: false # Don't use setjmp when running CMock. Note that this might result in late reporting or out-of-order failures.
colour: true
+143
View File
@@ -0,0 +1,143 @@
# =========================================================================
# CMock - Automatic Mock Generation for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\'
compiler:
path: [*tools_root, 'arm\bin\iccarm.exe']
source_path: 'src\'
unit_tests_path: &unit_tests_path 'test\'
build_path: &build_path 'build\'
options:
- --dlib_config
- [*tools_root, 'arm\lib\dl4tptinl8n.h']
- -z3
- --no_cse
- --no_unroll
- --no_inline
- --no_code_motion
- --no_tbaa
- --no_clustering
- --no_scheduling
- --debug
- --cpu_mode thumb
- --endian little
- --cpu ARM7TDMI
- --stack_align 4
- --interwork
- -e
- --silent
- --warnings_are_errors
- --fpu None
- --diag_suppress Pa050
includes:
prefix: '-I'
items:
- 'src/'
- '../../src/'
- '../../vendor/unity/src/'
- '../../vendor/unity/examples/example_3/helper/'
- './build/mocks/'
- [*tools_root, 'arm\inc\']
- *unit_tests_path
defines:
prefix: '-D'
items:
object_files:
prefix: '-o'
extension: '.r79'
destination: *build_path
linker:
path: [*tools_root, 'common\bin\xlink.exe']
options:
- -rt
- [*tools_root, 'arm\lib\dl4tptinl8n.r79']
- -D_L_EXTMEM_START=0
- -D_L_EXTMEM_SIZE=0
- -D_L_HEAP_SIZE=120
- -D_L_STACK_SIZE=32
- -e_small_write=_formatted_write
- -s
- __program_start
- -f
- [*tools_root, '\arm\config\lnkarm.xcl']
includes:
prefix: '-I'
items:
- [*tools_root, 'arm\config\']
- [*tools_root, 'arm\lib\']
object_files:
path: *build_path
extension: '.r79'
bin_files:
prefix: '-o'
extension: '.d79'
destination: *build_path
simulator:
path: [*tools_root, 'common\bin\CSpyBat.exe']
pre_support:
- --silent
- [*tools_root, 'arm\bin\armproc.dll']
- [*tools_root, 'arm\bin\armsim.dll']
post_support:
- --plugin
- [*tools_root, 'arm\bin\armbat.dll']
- --backend
- -B
- -p
- [*tools_root, 'arm\config\ioat91sam7X256.ddf']
- -d
- sim
:cmock:
# Core conffiguration
:plugins: [] # What plugins should be used by CMock?
:verbosity: 2 # the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose
:when_no_prototypes: :warn # the options being :ignore, :warn, or :erro
# File configuration
:mock_path: './build/mocks' # Subdirectory to store mocks when generated (default: mocks)
:skeleton_path: './' # Subdirectory to store stubs when generated (default: '')
:mock_prefix: 'Mock' # Prefix to append to filenames for mocks
:mock_suffix: '' # Suffix to append to filenames for mocks
# Parser configuration
:strippables: ['(?:__attribute__\s*\([ (]*.*?[ )]*\)+)']
:attributes:
- __ramfunc
- __irq
- __fiq
- register
- extern
:c_calling_conventions:
- __stdcall
- __cdecl
- __fastcall
:treat_externs: :exclude # the options being :include or :exclud
:treat_inlines: :exclude # the options being :include or :exclud
# Type handling configuration
#:unity_helper_path: '' # specify a string of where to find a unity_helper.h file to discover custom type assertions
#:treat_as: {} # optionally add additional types to map custom types
#:treat_as_array: {} # hint to cmock that these types are pointers to something
#:treat_as_void: [] # hint to cmock that these types are actually aliases of void
:memcmp_if_unknown: true # allow cmock to use the memory comparison assertions for unknown types
:when_ptr: :compare_data # hint to cmock how to handle pointers in general, the options being :compare_ptr, :compare_data, or :smart
# Mock generation configuration
:weak: '' # Symbol to use to declare weak functions
:enforce_strict_ordering: false # Do we want cmock to enforce ordering of all function calls?
:fail_on_unexpected_calls: true # Do we want cmock to fail when it encounters a function call that wasn't expected?
:callback_include_count: true # Do we want cmock to include the number of calls to this callback, when using callbacks?
:callback_after_arg_check: false # Do we want cmock to enforce an argument check first when using a callback?
:includes: # You can add additional includes here, or specify the location with the options below
- Types.h
#:includes_h_pre_orig_header: []
#:includes_h_post_orig_header: []
#:includes_c_pre_header: []
#:includes_c_post_header: []
#:array_size_type: [] # Specify a type or types that should be used for array lengths
#:array_size_name: 'size|len' # Specify a name or names that CMock might automatically recognize as the length of an array
:exclude_setjmp_h: false # Don't use setjmp when running CMock. Note that this might result in late reporting or out-of-order failures.
+132
View File
@@ -0,0 +1,132 @@
# =========================================================================
# CMock - Automatic Mock Generation for C
# ThrowTheSwitch.org
# Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
# SPDX-License-Identifier: MIT
# =========================================================================
tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\'
compiler:
path: [*tools_root, 'arm\bin\iccarm.exe']
source_path: 'src\'
unit_tests_path: &unit_tests_path 'test\'
build_path: &build_path 'build\'
options:
- --dlib_config
- [*tools_root, 'arm\inc\DLib_Config_Normal.h']
- --no_cse
- --no_unroll
- --no_inline
- --no_code_motion
- --no_tbaa
- --no_clustering
- --no_scheduling
- --debug
- --cpu_mode thumb
- --endian=little
- --cpu=ARM7TDMI
- --interwork
- --warnings_are_errors
- --fpu=None
- --diag_suppress=Pa050
- --diag_suppress=Pe111
- -e
- -On
includes:
prefix: '-I'
items:
- 'src/'
- '../../src/'
- '../../vendor/unity/src/'
- '../../vendor/unity/examples/example_3/helper/'
- './build/mocks/'
- [*tools_root, 'arm\inc\']
- *unit_tests_path
defines:
prefix: '-D'
items:
object_files:
prefix: '-o'
extension: '.r79'
destination: *build_path
linker:
path: [*tools_root, 'arm\bin\ilinkarm.exe']
options:
- --redirect _Printf=_PrintfLarge
- --redirect _Scanf=_ScanfSmall
- --semihosting
- --entry __iar_program_start
- --config
- [*tools_root, 'arm\config\generic.icf']
object_files:
path: *build_path
extension: '.o'
bin_files:
prefix: '-o'
extension: '.out'
destination: *build_path
simulator:
path: [*tools_root, 'common\bin\CSpyBat.exe']
pre_support:
- --silent
- [*tools_root, 'arm\bin\armproc.dll']
- [*tools_root, 'arm\bin\armsim.dll']
post_support:
- --plugin
- [*tools_root, 'arm\bin\armbat.dll']
- --backend
- -B
- -p
- [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf']
- -d
- sim
:cmock:
# Core conffiguration
:plugins: [] # What plugins should be used by CMock?
:verbosity: 2 # the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose
:when_no_prototypes: :warn # the options being :ignore, :warn, or :erro
# File configuration
:mock_path: './build/mocks' # Subdirectory to store mocks when generated (default: mocks)
:skeleton_path: '' # Subdirectory to store stubs when generated (default: '')
:mock_prefix: 'Mock' # Prefix to append to filenames for mocks
:mock_suffix: '' # Suffix to append to filenames for mocks
# Parser configuration
:strippables: ['(?:__attribute__\s*\([ (]*.*?[ )]*\)+)']
:attributes:
- __ramfunc
- __irq
- __fiq
- register
- extern
:c_calling_conventions:
- __stdcall
- __cdecl
- __fastcall
:treat_externs: :exclude # the options being :include or :exclud
:treat_inlines: :exclude # the options being :include or :exclud
# Type handling configuration
#:unity_helper_path: '' # specify a string of where to find a unity_helper.h file to discover custom type assertions
#:treat_as: {} # optionally add additional types to map custom types
#:treat_as_array: {} # hint to cmock that these types are pointers to something
#:treat_as_void: [] # hint to cmock that these types are actually aliases of void
:memcmp_if_unknown: true # allow cmock to use the memory comparison assertions for unknown types
:when_ptr: :compare_data # hint to cmock how to handle pointers in general, the options being :compare_ptr, :compare_data, or :smart
# Mock generation configuration
:weak: '' # Symbol to use to declare weak functions
:enforce_strict_ordering: false # Do we want cmock to enforce ordering of all function calls?
:fail_on_unexpected_calls: true # Do we want cmock to fail when it encounters a function call that wasn't expected?
:callback_include_count: true # Do we want cmock to include the number of calls to this callback, when using callbacks?
:callback_after_arg_check: false # Do we want cmock to enforce an argument check first when using a callback?
:includes: # You can add additional includes here, or specify the location with the options below
- Types.h
#:includes_h_pre_orig_header: []
#:includes_h_post_orig_header: []
#:includes_c_pre_header: []
#:includes_c_post_header: []
#:array_size_type: [] # Specify a type or types that should be used for array lengths
#:array_size_name: 'size|len' # Specify a name or names that CMock might automatically recognize as the length of an array
:exclude_setjmp_h: false # Don't use setjmp when running CMock. Note that this might result in late reporting or out-of-order failures.
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "UnityHelper.h"
#include "Types.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "AdcHardware.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "AdcHardwareConfigurator.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "AdcModel.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "AdcTemperatureSensor.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "Executor.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "MockExecutor.h"
+7
View File
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "Model.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "TaskScheduler.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "TemperatureCalculator.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "TemperatureFilter.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "TimerConductor.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "TimerConfigurator.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "TimerHardware.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "TimerInterruptConfigurator.h"
@@ -35,9 +42,9 @@ void testResetSystemTimeDelegatesTo_Timer_SetSystemTime_Appropriately(void)
void testConfigureInterruptShouldSetInterruptHandlerAppropriately(void)
{
AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = (uint32)NULL;
AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0] = 0;
Timer_ConfigureInterrupt();
TEST_ASSERT_EQUAL((uint32)Timer_InterruptHandler, AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0]);
TEST_ASSERT_EQUAL_PTR(Timer_InterruptHandler, AT91C_BASE_AIC->AIC_SVR[AT91C_ID_TC0]);
}
void testConfigureInterruptShouldSetInterruptLevelInSourceModeRegisterAppropriately(void)
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "TimerInterruptHandler.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "TimerModel.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "UsartBaudRateRegisterCalculator.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "UsartConductor.h"
@@ -1,3 +1,10 @@
/* =========================================================================
CMock - Automatic Mock Generation for C
ThrowTheSwitch.org
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
SPDX-License-Identifier: MIT
========================================================================= */
#include "unity.h"
#include "Types.h"
#include "UsartConfigurator.h"

Some files were not shown because too many files have changed in this diff Show More