<commit_before>/**
 * \file
 * \brief Mock of Semaphore class
 *
 * \author Copyright (C) 2017 <NAME> http://www.distortec.com http://www.freddiechopin.info
 *
 * \par License
 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
 * distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef UNIT_TEST_INCLUDE_MOCKS_SEMAPHORE_HPP_DISTORTOS_SEMAPHORE_HPP_
#define UNIT_TEST_INCLUDE_MOCKS_SEMAPHORE_HPP_DISTORTOS_SEMAPHORE_HPP_

#include "unit-test-common.hpp"

#include "distortos/TickClock.hpp"

namespace distortos
{

class Semaphore
{
public:

	using Value = unsigned int;

	Semaphore() = default;

	explicit Semaphore(const Value value, const Value maxValue = std::numeric_limits<Value>::max())
	{
		REQUIRE(getProxyInstance() != nullptr);
		getProxyInstance()->construct(value, maxValue);
	}

	virtual ~Semaphore()
	{

	}

	MAKE_MOCK2(construct, void(Value, Value));
	MAKE_CONST_MOCK0(getValue, Value());
	MAKE_MOCK0(post, int());
	MAKE_MOCK0(tryWait, int());
	MAKE_MOCK1(tryWaitFor, int(TickClock::duration));
	MAKE_MOCK1(tryWaitUntil, int(TickClock::time_point));
	MAKE_MOCK0(wait, int());

	static Semaphore*& getProxyInstance()
	{
		static Semaphore* proxyInstance;
		return proxyInstance;
	}<commit_msg>Remove default argument values from constructor of Semaphore mock<commit_after>/**
 * \file
 * \brief Mock of Semaphore class
 *
 * \author Copyright (C) 2017 <NAME> http://www.distortec.com http://www.freddiechopin.info
 *
 * \par License
 * This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not
 * distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
 */

#ifndef UNIT_TEST_INCLUDE_MOCKS_SEMAPHORE_HPP_DISTORTOS_SEMAPHORE_HPP_
#define UNIT_TEST_INCLUDE_MOCKS_SEMAPHORE_HPP_DISTORTOS_SEMAPHORE_HPP_

#include "unit-test-common.hpp"

#include "distortos/TickClock.hpp"

namespace distortos
{

class Semaphore
{
public:

	using Value = unsigned int;

	Semaphore() = default;

	Semaphore(const Value value, const Value maxValue)
	{
		REQUIRE(getProxyInstance() != nullptr);
		getProxyInstance()->construct(value, maxValue);
	}

	virtual ~Semaphore()
	{

	}

	MAKE_MOCK2(construct, void(Value, Value));
	MAKE_CONST_MOCK0(getValue, Value());
	MAKE_MOCK0(post, int());
	MAKE_MOCK0(tryWait, int());
	MAKE_MOCK1(tryWaitFor, int(TickClock::duration));
	MAKE_MOCK1(tryWaitUntil, int(TickClock::time_point));
	MAKE_MOCK0(wait, int());

	static Semaphore*& getProxyInstance()
	{
		static Semaphore* proxyInstance;
		return proxyInstance;
	}
{'fraction_non_alphanumeric': 0.11856652687762105, 'fraction_numerical': 0.011437285550895921, 'mean_word_length': 5.338164251207729, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5999060', 'n_tokens_mistral': 997, 'n_tokens_neox': 921, 'n_words': 218}