Beispiel #1
0
template<typename T> inline
void
circular_buffer<T>::shift_left(size_type &index, size_type offset) const
{
	requires(index < this->_capacity);
	requires(offset <= this->_capacity);

	if (index >= offset)
	{
		ensures((index - offset) < this->_capacity);
		index -= offset;
	}
	else
	{
		ensures((index + this->_capacity - offset) < this->_capacity);
		index += (this->_capacity - offset);
	}
}
Beispiel #2
0
template<typename T> inline
void
circular_buffer<T>::shift_right(size_type &index, size_type offset) const
{
	requires(index < this->_capacity);
	requires(offset <= this->_capacity);

	index += offset;
	if (index >= this->_capacity)
	{
		index -= this->_capacity;
	}

	ensures(index < this->_capacity);
}
Beispiel #3
0
void p() {
  ensures(g == old(g));
  g++;
}
Beispiel #4
0
 PositiveNumber(T k) {
   requires(k > 0);
   value = k;
   ensures(value > 0);
 }