Skip to content

Commit

Permalink
Add license information to header
Browse files Browse the repository at this point in the history
  • Loading branch information
bernedom committed Mar 24, 2021
1 parent 33d122e commit 2a52d29
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 9 deletions.
11 changes: 11 additions & 0 deletions include/SI/detail/cross_unit_operations.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/**
* This file is part of "SI" version 2.1.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
*
* https://github.com/bernedom/SI
*
* SPDX-License-Identifier: MIT
*
**/
#pragma once

#include "detail.h"
Expand Down
11 changes: 11 additions & 0 deletions include/SI/detail/eps_equal.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/**
* This file is part of "SI" version 2.1.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
*
* https://github.com/bernedom/SI
*
* SPDX-License-Identifier: MIT
*
**/
#pragma once

#include <limits>
Expand Down
11 changes: 11 additions & 0 deletions include/SI/detail/unit_cast.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
/**
* This file is part of "SI" version 2.1.0
* A header only c++ library that provides type safety and user defined literals
* for handling pyhsical values defined in the International System of
* Units
*
* https://github.com/bernedom/SI
*
* SPDX-License-Identifier: MIT
*
**/
#pragma once

#include "detail.h"
Expand Down
17 changes: 8 additions & 9 deletions test/version-consistency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
ROOT_DIR=$(realpath ${SCRIPT_DIR}/../)

set -e

setUp() {
SI_BUILD_DIR=$(mktemp -d)
BUILD_DIR=$(mktemp -d)
Expand All @@ -15,36 +13,37 @@ tearDown() {
if [ -d ${SI_BUILD_DIR} ]; then
rm -rf ${SI_BUILD_DIR}
fi

if [ -d ${BUILD_DIR} ]; then
rm -rf ${BUILD_DIR}
fi
}

testVersionNumberConsistency() {

CHANGELOG_VERSION=$(sed -n -E '/## [0-9]+\.[0-9]+\.[0-9]+/p' ${ROOT_DIR}/CHANGELOG.md | head -1 | grep -E -o '[0-9]+\.[0-9]+\.[0-9]+')
ORIG_DIR=$(pwd)

cmake ${ROOT_DIR} -B${SI_BUILD_DIR} -DBUILD_TESTING=off -DCMAKE_BUILD_TYPE=Debug >/dev/null
cd ${SI_BUILD_DIR}
CMAKE_VERSION=$(cmake --system-information | grep -E "VERSION:STATIC" | grep -E -o '[0-9]+\.[0-9]+\.[0-9]+')
cd ${ORIG_DIR}
GIT_VERSION_EXACT=$(git describe --tags | { grep -E -o '^[0-9]+\.[0-9]+\.[0-9]+$' || true; } )
GIT_VERSION_EXACT=$(git describe --tags | { grep -E -o '^[0-9]+\.[0-9]+\.[0-9]+$' || true; })

assertEquals "version in changelog (${CHANGELOG_VERSION}) does not match cmake version (${CMAKE_VERSION})" $CHANGELOG_VERSION $CMAKE_VERSION

if [ "${GIT_VERSION_EXACT}" != "" ]; then
assertEquals "version in files (${CMAKE_VERSION}) does not match git tag for release (${GIT_VERSION_EXACT})" ${CMAKE_VERSION} ${GIT_VERSION_EXACT}
else
GIT_VERSION=$(git describe --tags | grep -E -o '^[0-9]+\.[0-9]+\.[0-9]+')
assertNotEquals "version in files (${CMAKE_VERSION}) matches already existing release (${GIT_VERSION}):" ${CMAKE_VERSION} ${GIT_VERSION}
fi

for F in $(find ${ROOT_DIR}/include/SI -name "*.h"); do
FILE_VERSION=$(grep -E 'version [0-9]+\.[0-9]+\.[0-9]+' ${F} | grep -E -o '[0-9]+\.[0-9]+\.[0-9]+')
assertEquals "version in header file ${F} does not match cmake version" ${CMAKE_VERSION} ${FILE_VERSION}
done

}

# Load shUnit2.
Expand Down

0 comments on commit 2a52d29

Please sign in to comment.