2018-06-13 04:33:08 +08:00
|
|
|
#include "testing.h"
|
2020-02-25 23:11:52 +08:00
|
|
|
#include "flang/Evaluate/type.h"
|
2018-06-13 04:33:08 +08:00
|
|
|
#include <cstdio>
|
|
|
|
|
2020-03-29 12:00:16 +08:00
|
|
|
template <int KIND> void testKind() {
|
2018-06-20 05:17:14 +08:00
|
|
|
using Type =
|
2018-08-02 00:45:59 +08:00
|
|
|
Fortran::evaluate::Type<Fortran::common::TypeCategory::Logical, KIND>;
|
2018-11-30 02:25:46 +08:00
|
|
|
TEST(Fortran::evaluate::IsSpecificIntrinsicType<Type>);
|
2018-08-02 00:45:59 +08:00
|
|
|
TEST(Type::category == Fortran::common::TypeCategory::Logical);
|
2018-06-13 04:33:08 +08:00
|
|
|
TEST(Type::kind == KIND);
|
2018-08-14 08:05:15 +08:00
|
|
|
using Value = Fortran::evaluate::Scalar<Type>;
|
2018-06-13 04:33:08 +08:00
|
|
|
MATCH(8 * KIND, Value::bits);
|
|
|
|
TEST(!Value{}.IsTrue());
|
|
|
|
TEST(!Value{false}.IsTrue());
|
|
|
|
TEST(Value{true}.IsTrue());
|
|
|
|
TEST(Value{false}.NOT().IsTrue());
|
|
|
|
TEST(!Value{true}.NOT().IsTrue());
|
|
|
|
TEST(!Value{false}.AND(Value{false}).IsTrue());
|
|
|
|
TEST(!Value{false}.AND(Value{true}).IsTrue());
|
|
|
|
TEST(!Value{true}.AND(Value{false}).IsTrue());
|
|
|
|
TEST(Value{true}.AND(Value{true}).IsTrue());
|
|
|
|
TEST(!Value{false}.OR(Value{false}).IsTrue());
|
|
|
|
TEST(Value{false}.OR(Value{true}).IsTrue());
|
|
|
|
TEST(Value{true}.OR(Value{false}).IsTrue());
|
|
|
|
TEST(Value{true}.OR(Value{true}).IsTrue());
|
|
|
|
TEST(Value{false}.EQV(Value{false}).IsTrue());
|
|
|
|
TEST(!Value{false}.EQV(Value{true}).IsTrue());
|
|
|
|
TEST(!Value{true}.EQV(Value{false}).IsTrue());
|
|
|
|
TEST(Value{true}.EQV(Value{true}).IsTrue());
|
|
|
|
TEST(!Value{false}.NEQV(Value{false}).IsTrue());
|
|
|
|
TEST(Value{false}.NEQV(Value{true}).IsTrue());
|
|
|
|
TEST(Value{true}.NEQV(Value{false}).IsTrue());
|
|
|
|
TEST(!Value{true}.NEQV(Value{true}).IsTrue());
|
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
testKind<1>();
|
|
|
|
testKind<2>();
|
|
|
|
testKind<4>();
|
|
|
|
testKind<8>();
|
|
|
|
return testing::Complete();
|
|
|
|
}
|