Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Insarudo
project
Commits
603f3995
There was a problem fetching the pipeline summary.
Commit
603f3995
authored
8 years ago
by
Bun Sovandeth
Browse files
Options
Downloads
Patches
Plain Diff
add file
parent
0ed1cd70
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cmocka_pbc.h
+62
-0
62 additions, 0 deletions
src/cmocka_pbc.h
with
62 additions
and
0 deletions
src/cmocka_pbc.h
0 → 100644
+
62
−
0
View file @
603f3995
/*
* Copyright 2014 Luis Pabon, Jr.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Programming by Contract is a programming methodology
* which binds the caller and the function called to a
* contract. The contract is represented using Hoare Triple:
* {P} C {Q}
* where {P} is the precondition before executing command C,
* and {Q} is the postcondition.
*
* See also:
* http://en.wikipedia.org/wiki/Design_by_contract
* http://en.wikipedia.org/wiki/Hoare_logic
* http://dlang.org/dbc.html
*/
#ifndef CMOCKA_PBC_H_
#define CMOCKA_PBC_H_
#if defined(UNIT_TESTING) || defined (DEBUG)
#include
<assert.h>
/*
* Checks caller responsibility against contract
*/
#define REQUIRE(cond) assert(cond)
/*
* Checks function reponsability against contract.
*/
#define ENSURE(cond) assert(cond)
/*
* While REQUIRE and ENSURE apply to functions, INVARIANT
* applies to classes/structs. It ensures that intances
* of the class/struct are consistent. In other words,
* that the instance has not been corrupted.
*/
#define INVARIANT(invariant_fnc) do{ (invariant_fnc) } while (0);
#else
#define REQUIRE(cond) do { } while (0);
#define ENSURE(cond) do { } while (0);
#define INVARIANT(invariant_fnc) do{ } while (0);
#endif
/* defined(UNIT_TESTING) || defined (DEBUG) */
#endif
/* CMOCKA_PBC_H_ */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment