Code coverage for lip_integer.li
///////////////////////////////////////////////////////////////////////////////
// Lisaac Compiler //
// //
// LSIIT - ULP - CNRS - INRIA - FRANCE //
// //
// This program is free software: you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation, either version 3 of the License, or //
// (at your option) any later version. //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
// //
// http://isaacproject.u-strasbg.fr/ //
///////////////////////////////////////////////////////////////////////////////
Section Header
+ name := LIP_INTEGER;
- copyright := "2003-2008 Sonntag Benoit";
- author := "Sonntag Benoit (sonntag@icps.u-strasbg.fr)";
- comment := "The main prototype";
Section Inherit
+ parent_lip_constant:Expanded LIP_CONSTANT;
Section Private
- storage:FAST_ARRAY(LIP_INTEGER) := FAST_ARRAY(LIP_INTEGER).create_with_capacity 10;
- set_value v:INTEGER <-
(
value := v;
);
Section Public
+ value:INTEGER;
//
// Creation.
//
- get i:INTEGER :LIP_INTEGER <-
( + result:LIP_INTEGER;
(storage.is_empty).if {
result := clone;
} else {
result := storage.last;
storage.remove_last;
};
result.set_value i;
result
);
- free <-
(
storage.add_last Self;
);
//
// Operation.
//
- name:STRING_CONSTANT <- "INTEGER";
- '-' Self:SELF :LIP_CONSTANT <-
(
value := - value;
Self
);
- '!' Self:SELF :LIP_CONSTANT <-
(
value := ~ value;
Self
);
- copy:LIP_CONSTANT <-
(
get value
);
- print <-
(
value.print;
);
Section LIP_CONSTANT
- my_copy other:SELF :LIP_CONSTANT <-
(
value := other.value;
Self
);
- Self:SELF '|#' other:SELF :LIP_CONSTANT <-
(
value := value | other.value;
other.free;
Self
);
- Self:SELF '&#' other:SELF :LIP_CONSTANT <-
(
value := value & other.value;
other.free;
Self
);
- Self:SELF '+#' other:SELF :LIP_CONSTANT <-
(
value := value + other.value;
other.free;
Self
);
- Self:SELF '-#' other:SELF :LIP_CONSTANT <-
(
value := value - other.value;
other.free;
Self
);
- Self:SELF '>#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value > other.value)
);
- Self:SELF '<#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value < other.value)
);
- Self:SELF '=#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value = other.value)
);
- Self:SELF '>=#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value >= other.value)
);
- Self:SELF '<=#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value <= other.value)
);
- Self:SELF '!=#' other:SELF :LIP_CONSTANT <-
(
other.free;
free;
LIP_BOOLEAN.get (value != other.value)
);