コード例 #1
0
ファイル: beargit.c プロジェクト: KishPatel1996/61C-Projects
int is_commit_msg_ok(const char* msg) {
  /* COMPLETE THE REST */
  while(msg != NULL && *msg != '\0'){
    if(*msg == 'T') {
      if(check_equal(msg))
        return 1;
    }
    ++msg;
  }
  return 0;
}
コード例 #2
0
ファイル: optimize.c プロジェクト: GoTcWang/c---compiler
void replace_variant(struct IR_node* st,struct IR_node* en,
		     struct Variant* v1,struct Variant* v2,struct IR_node* now) {
	do {
		if (st->attr==OPERATE) {
				if (check_equal(st->v2,v1)) st->v2=v2;
				if (check_equal(st->v3,v1)) st->v3=v2;
				if (check_equal(st->v1,v1)) {
					del(now);
					op_flag=1;
					break;
				}
		} else if (st->attr==CONDGOTO || st->attr==RETURN || st->attr==DEC2 ||
			   st->attr==ARG2 || st->attr==WRITE) {
				if (check_equal(st->v1,v1)) st->v1=v2;
				if (check_equal(st->v2,v1)) st->v2=v2;
				assert(st->v3==NULL);
		}
		st=st->next;
	}while (st!=en->next);	
	return;
}
コード例 #3
0
ファイル: lmsmaptest.cpp プロジェクト: jpakkane/lmsmap
    void multi_insert_test() {
        std::map<std::string, int> truth;
        LmsMap<std::string, int> trial;
        std::vector<std::string> data{{"bbb"}, {"aaa"}, {"ccc"},
        {"aouvawenJaauigasdnfkmj0n34nma0"}, {"abc"}};

        check_equal(truth, trial);
        int v=0;
        std::string::size_type totalsize = 0;
        for(const auto &i : data) {
            truth[i] = v;
            trial.insert(i, v);
            v++;
            totalsize += i.size();
            print(trial);
            check_equal(truth, trial);
            assert(totalsize == trial.keyblock_size());
        }

        truth["ccc"] = -1;
        trial.insert("ccc", -1);
        print(trial);
        check_equal(truth, trial);
    }
コード例 #4
0
ファイル: tst_workqueue.cpp プロジェクト: sletta/rengine
void tst_runOneJob()
{
    GLOBAL_COUNTER = 1;

    WorkQueue queue;
    shared_ptr<WorkQueue::Job> job(new OneJob(1));

    check_true(!job->hasCompleted());
    check_equal(static_cast<OneJob *>(job.get())->runId, -1);

    queue.schedule(job);

    // Spin a while loop, waiting 1 ms at a time, to see if the job completes
    // on its own. If we're still spinning after 10000 iterations, emit a warning
    // that the thing is probably locked up
    int counter = 0;
    while (!job->hasCompleted()) {
        this_thread::sleep_for(std::chrono::milliseconds(1));
        ++counter;
        if (counter > 10000) {
            cout << __FUNCTION__ << ": has with all likelyhood timed out, assuming failure!" << endl;
            check_true(false);
        }
    }

    if (counter == 0) {
        cout << " - job seems to have completed without any delay.. This is suspicious.." << endl;
        return;
    }

    // The runId should be the one we set up above, namely 1, as this is the
    // only job executing at present.
    check_equal(static_cast<OneJob *>(job.get())->runId, 1);

    cout << __FUNCTION__ << ": ok" << endl;
}
コード例 #5
0
ファイル: test_binnf.cpp プロジェクト: hbp-sanncs/cypress
TEST(binnf, python_communication)
{
	// Open the python loopback as a subprocess
	Process proc("python", {Resources::PYNN_BINNF_LOOPBACK.open()});

	// Generate a test data block
	const Block block_in_1 = generate_test_matrix_block();
	const Block block_in_2 = generate_test_log_block();

	// Send the data block to python
	serialise(proc.child_stdin(), block_in_1);
	serialise(proc.child_stdin(), block_in_2);
	serialise(proc.child_stdin(), block_in_2);
	serialise(proc.child_stdin(), block_in_1);
	serialise(proc.child_stdin(), block_in_2);
	serialise(proc.child_stdin(), block_in_2);
	serialise(proc.child_stdin(), block_in_1);
	serialise(proc.child_stdin(), block_in_1);
	proc.close_child_stdin();

	// Read it back, expect the deserialisation to be successful
	try {
		check_equal(block_in_1, deserialise(proc.child_stdout()));
		check_equal(block_in_2, deserialise(proc.child_stdout()));
		check_equal(block_in_2, deserialise(proc.child_stdout()));
		check_equal(block_in_1, deserialise(proc.child_stdout()));
		check_equal(block_in_2, deserialise(proc.child_stdout()));
		check_equal(block_in_2, deserialise(proc.child_stdout()));
		check_equal(block_in_1, deserialise(proc.child_stdout()));
		check_equal(block_in_1, deserialise(proc.child_stdout()));
	}
	catch (BinnfDecodeException &e) {
		// Most likely there is an error message
		char buf[4096];
		while (proc.child_stderr().good()) {
			proc.child_stderr().read(buf, 4096);
			std::cout.write(buf, proc.child_stderr().gcount());
		}
		EXPECT_TRUE(false);
	}

	// Make sure the Python code does not crash
	EXPECT_EQ(0, proc.wait());
}
コード例 #6
0
ファイル: check-qobject.c プロジェクト: CRYP706URU/pyrebox
static void qobject_is_equal_list_test(void)
{
    QList *list_0, *list_1, *list_cloned;
    QList *list_reordered, *list_longer, *list_shorter;

    list_0 = qlist_new();
    list_1 = qlist_new();
    list_reordered = qlist_new();
    list_longer = qlist_new();
    list_shorter = qlist_new();

    qlist_append_int(list_0, 1);
    qlist_append_int(list_0, 2);
    qlist_append_int(list_0, 3);

    qlist_append_int(list_1, 1);
    qlist_append_int(list_1, 2);
    qlist_append_int(list_1, 3);

    qlist_append_int(list_reordered, 1);
    qlist_append_int(list_reordered, 3);
    qlist_append_int(list_reordered, 2);

    qlist_append_int(list_longer, 1);
    qlist_append_int(list_longer, 2);
    qlist_append_int(list_longer, 3);
    qlist_append_null(list_longer);

    qlist_append_int(list_shorter, 1);
    qlist_append_int(list_shorter, 2);

    list_cloned = qlist_copy(list_0);

    check_equal(list_0, list_1, list_cloned);
    check_unequal(list_0, list_reordered, list_longer, list_shorter);

    /* With a NaN in it, the list should no longer compare equal to
     * itself */
    qlist_append(list_0, qnum_from_double(NAN));
    g_assert(qobject_is_equal(QOBJECT(list_0), QOBJECT(list_0)) == false);

    free_all(list_0, list_1, list_cloned, list_reordered, list_longer,
             list_shorter);
}
コード例 #7
0
gint
camel_url_equal (gconstpointer v,
                 gconstpointer v2)
{
	const CamelURL *u1 = v, *u2 = v2;

	return check_equal (u1->protocol, u2->protocol)
		&& check_equal (u1->user, u2->user)
		&& check_equal (u1->authmech, u2->authmech)
		&& check_equal (u1->host, u2->host)
		&& check_equal (u1->path, u2->path)
		&& check_equal (u1->query, u2->query)
		&& u1->port == u2->port;
}
コード例 #8
0
ファイル: unique_copy.cpp プロジェクト: CornedBee/range-v3
int main()
{
    test<input_iterator<const int*>, output_iterator<int*> >();
    test<input_iterator<const int*>, forward_iterator<int*> >();
    test<input_iterator<const int*>, bidirectional_iterator<int*> >();
    test<input_iterator<const int*>, random_access_iterator<int*> >();
    test<input_iterator<const int*>, int*>();

    test<forward_iterator<const int*>, output_iterator<int*> >();
    test<forward_iterator<const int*>, forward_iterator<int*> >();
    test<forward_iterator<const int*>, bidirectional_iterator<int*> >();
    test<forward_iterator<const int*>, random_access_iterator<int*> >();
    test<forward_iterator<const int*>, int*>();

    test<bidirectional_iterator<const int*>, output_iterator<int*> >();
    test<bidirectional_iterator<const int*>, forward_iterator<int*> >();
    test<bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
    test<bidirectional_iterator<const int*>, random_access_iterator<int*> >();
    test<bidirectional_iterator<const int*>, int*>();

    test<random_access_iterator<const int*>, output_iterator<int*> >();
    test<random_access_iterator<const int*>, forward_iterator<int*> >();
    test<random_access_iterator<const int*>, bidirectional_iterator<int*> >();
    test<random_access_iterator<const int*>, random_access_iterator<int*> >();
    test<random_access_iterator<const int*>, int*>();

    test<const int*, output_iterator<int*> >();
    test<const int*, forward_iterator<int*> >();
    test<const int*, bidirectional_iterator<int*> >();
    test<const int*, random_access_iterator<int*> >();
    test<const int*, int*>();

    // Test projections:
    S const ia[] = {{1,1},{2,2},{3,3},{3,4},{4,5},{5,6},{5,7},{5,8},{6,9},{7,10}};
    S ib[ranges::size(ia)];
    std::pair<S const *, S *> r = ranges::unique_copy(ia, ib, ranges::equal_to(), &S::i);
    CHECK(r.first == ranges::end(ia));
    CHECK(r.second == ib + 7);
    check_equal(ranges::make_range(ib, ib+7), {S{1,1},S{2,2},S{3,3},S{4,5},S{5,6},S{6,9},S{7,10}});

    return ::test_result();
}
コード例 #9
0
//evaluates mult_i polynomial for layer 59+d of the F0 circuit
void
FLT_mul_lvl2(mpz_t rop, const mpz_t* r, int mi, int mip1, int ni, int nip1, const mpz_t prime)
{
   mpz_t ans;
   mpz_init_set(ans, r[0]);

   //odds ps go to p/2 for both in1 and in2
   /*
   uint64 ans = r[0];
   uint64 temp;
   */

   //now make sure p>>1 matches in1 and in2
   check_equal(ans, &r[1], &r[mi], &r[mi+mip1], 0, mip1, prime);

   mpz_set(rop, ans);
   //return ans;

   mpz_clear(ans);
}
コード例 #10
0
ファイル: check-qobject.c プロジェクト: CRYP706URU/pyrebox
static void qobject_is_equal_string_test(void)
{
    QString *str_base, *str_whitespace_0, *str_whitespace_1, *str_whitespace_2;
    QString *str_whitespace_3, *str_case, *str_built;

    str_base = qstring_from_str("foo");
    str_whitespace_0 = qstring_from_str(" foo");
    str_whitespace_1 = qstring_from_str("foo ");
    str_whitespace_2 = qstring_from_str("foo\b");
    str_whitespace_3 = qstring_from_str("fooo\b");
    str_case = qstring_from_str("Foo");

    /* Should yield "foo" */
    str_built = qstring_from_substr("form", 0, 1);
    qstring_append_chr(str_built, 'o');

    check_unequal(str_base, str_whitespace_0, str_whitespace_1,
                  str_whitespace_2, str_whitespace_3, str_case);

    check_equal(str_base, str_built);

    free_all(str_base, str_whitespace_0, str_whitespace_1, str_whitespace_2,
             str_whitespace_3, str_case, str_built);
}
コード例 #11
0
ファイル: wxImage.cpp プロジェクト: Hanmac/rwx
VALUE _equal_block(equal_obj *obj)
{
	return wrap(check_equal(*obj->self, unwrap<wxImage>(obj->other)));
}
コード例 #12
0
ファイル: 0070-null_empty.cpp プロジェクト: Whissi/librdkafka
static void do_test_null_empty (bool api_version_request) {
  std::string topic = Test::mk_topic_name("0070_null_empty", 1);
  const int partition = 0;

  Test::Say(tostr() << "Testing with api.version.request=" << api_version_request << " on topic " << topic << " partition " << partition << "\n");

  RdKafka::Conf *conf;
  Test::conf_init(&conf, NULL, 0);
  Test::conf_set(conf, "api.version.request",
                 api_version_request ? "true" : "false");
  Test::conf_set(conf, "acks", "all");


  std::string errstr;
  RdKafka::Producer *p = RdKafka::Producer::create(conf, errstr);
  if (!p)
    Test::Fail("Failed to create Producer: " + errstr);
  delete conf;

  const int msgcnt = 8;
  static const char *msgs[msgcnt*2] = {
    NULL, NULL,
    "key2", NULL,
    "key3", "val3",
    NULL, "val4",
    "", NULL,
    NULL, "",
    "", ""
  };

  RdKafka::ErrorCode err;

  for (int i = 0 ; i < msgcnt * 2 ; i += 2) {
    Test::Say(3, tostr() << "Produce message #" << (i/2) <<
              ": key=\"" << (msgs[i] ? msgs[i] : "Null") <<
              "\", value=\"" << (msgs[i+1] ? msgs[i+1] : "Null") << "\"\n");
    err = p->produce(topic, partition, RdKafka::Producer::RK_MSG_COPY,
                     /* Value */
                     (void *)msgs[i+1], msgs[i+1] ? strlen(msgs[i+1]) : 0,
                     /* Key */
                     (void *)msgs[i], msgs[i] ? strlen(msgs[i]) : 0,
                     0, NULL);
    if (err != RdKafka::ERR_NO_ERROR)
      Test::Fail("Produce failed: " + RdKafka::err2str(err));
  }

  if (p->flush(tmout_multip(3*5000)) != 0)
    Test::Fail("Not all messages flushed");

  Test::Say(tostr() << "Produced " << msgcnt << " messages to " << topic << "\n");

  delete p;

  /*
   * Now consume messages from the beginning, making sure they match
   * what was produced.
   */

  /* Create consumer */
  Test::conf_init(&conf, NULL, 10);
  Test::conf_set(conf, "group.id", topic);
  Test::conf_set(conf, "api.version.request",
                 api_version_request ? "true" : "false");
  Test::conf_set(conf, "enable.auto.commit", "false");

  RdKafka::KafkaConsumer *c = RdKafka::KafkaConsumer::create(conf, errstr);
  if (!c)
    Test::Fail("Failed to create KafkaConsumer: " + errstr);
  delete conf;

  /* Assign the partition */
  std::vector<RdKafka::TopicPartition*> parts;
  parts.push_back(RdKafka::TopicPartition::create(topic, partition,
                                                 RdKafka::Topic::OFFSET_BEGINNING));
  err = c->assign(parts);
  if (err != RdKafka::ERR_NO_ERROR)
    Test::Fail("assign() failed: " + RdKafka::err2str(err));
  RdKafka::TopicPartition::destroy(parts);

  /* Start consuming */
  int failures = 0;
  for (int i = 0 ; i < msgcnt * 2 ; i += 2) {
    RdKafka::Message *msg = c->consume(tmout_multip(5000));
    if (msg->err())
      Test::Fail(tostr() << "consume() failed at message " << (i/2) << ": " <<
                 msg->errstr());

    /* verify key */
    failures += check_equal(msgs[i], msg->key() ? msg->key()->c_str() : NULL, msg->key_len(),
                            tostr() << "message #" << (i/2) << " (offset " << msg->offset() << ") key");
    /* verify key_pointer() API as too */
    failures += check_equal(msgs[i], (const char *)msg->key_pointer(), msg->key_len(),
                tostr() << "message #" << (i/2) << " (offset " << msg->offset() << ") key");

    /* verify value */
    failures += check_equal(msgs[i+1], (const char *)msg->payload(), msg->len(),
                tostr() << "message #" << (i/2) << " (offset " << msg->offset() << ") value");
    delete msg;
  }

  Test::Say(tostr() << "Done consuming, closing. " << failures << " test failures\n");
  if (failures)
    Test::Fail(tostr() << "See " << failures << "  previous test failure(s)");

  c->close();
  delete c;
}
コード例 #13
0
TEST_F(IntersectionsTest, FindLinesIntersectionTest) {
  {
    const point p0{1, 4}, p1{5, 6};
    const point q0{4, 1}, q1{2, 9};
    const point i{3, 5};

    SCOPED_TRACE("First test");
    check_equal(i, cpl::find_lines_intersection(p0, p1, q0, q1));
    check_equal(i, cpl::find_lines_intersection(p0, p1, q1, q0));
    check_equal(i, cpl::find_lines_intersection(p1, p0, q0, q1));
    check_equal(i, cpl::find_lines_intersection(p1, p0, q1, q0));
  }

  const auto a = line{{-3, 1}, {4, 1}};
  const auto b = line{{-1, -2}, {-1, 5}};
  const auto c = line{{4, 4}, {1, 3}};
  const auto d = line{{-2, 5}, {3, 0}};

  check_equal(point(-1, 1), find_intersection(a, b));
  check_equal(point(-5, 1), find_intersection(a, c));
  check_equal(point(2, 1), find_intersection(a, d));

  check_equal(point(-1, 1), find_intersection(b, a));
  check_equal(point(-1, 7.0f / 3), find_intersection(b, c));
  check_equal(point(-1, 4), find_intersection(b, d));

  check_equal(point(-5, 1), find_intersection(c, a));
  check_equal(point(-1, 7.0f / 3), find_intersection(c, b));
  check_equal(point(0.25f, 2.75f), find_intersection(c, d));

  check_equal(point(2, 1), find_intersection(d, a));
  check_equal(point(-1, 4), find_intersection(d, b));
  check_equal(point(0.25f, 2.75f), find_intersection(d, c));
}
コード例 #14
0
ファイル: unique_copy.cpp プロジェクト: ericniebler/range-v3
int main()
{
    test<input_iterator<const int*>, output_iterator<int*> >();
    test<input_iterator<const int*>, forward_iterator<int*> >();
    test<input_iterator<const int*>, bidirectional_iterator<int*> >();
    test<input_iterator<const int*>, random_access_iterator<int*> >();
    test<input_iterator<const int*>, int*>();

    test<forward_iterator<const int*>, output_iterator<int*> >();
    test<forward_iterator<const int*>, forward_iterator<int*> >();
    test<forward_iterator<const int*>, bidirectional_iterator<int*> >();
    test<forward_iterator<const int*>, random_access_iterator<int*> >();
    test<forward_iterator<const int*>, int*>();

    test<bidirectional_iterator<const int*>, output_iterator<int*> >();
    test<bidirectional_iterator<const int*>, forward_iterator<int*> >();
    test<bidirectional_iterator<const int*>, bidirectional_iterator<int*> >();
    test<bidirectional_iterator<const int*>, random_access_iterator<int*> >();
    test<bidirectional_iterator<const int*>, int*>();

    test<random_access_iterator<const int*>, output_iterator<int*> >();
    test<random_access_iterator<const int*>, forward_iterator<int*> >();
    test<random_access_iterator<const int*>, bidirectional_iterator<int*> >();
    test<random_access_iterator<const int*>, random_access_iterator<int*> >();
    test<random_access_iterator<const int*>, int*>();

    test<const int*, output_iterator<int*> >();
    test<const int*, forward_iterator<int*> >();
    test<const int*, bidirectional_iterator<int*> >();
    test<const int*, random_access_iterator<int*> >();
    test<const int*, int*>();

    // Test projections:
    {
        S const ia[] = {{1,1},{2,2},{3,3},{3,4},{4,5},{5,6},{5,7},{5,8},{6,9},{7,10}};
        S ib[ranges::size(ia)];
        ranges::unique_copy_result<S const *, S *> r = ranges::unique_copy(ia, ib, ranges::equal_to(), &S::i);
        CHECK(r.in == ranges::end(ia));
        CHECK(r.out == ib + 7);
        check_equal(ranges::make_subrange(ib, ib+7), {S{1,1},S{2,2},S{3,3},S{4,5},S{5,6},S{6,9},S{7,10}});
    }

    // Test rvalue ranges:
    {
        S const ia[] = {{1,1},{2,2},{3,3},{3,4},{4,5},{5,6},{5,7},{5,8},{6,9},{7,10}};
        S ib[ranges::size(ia)];
        auto r = ranges::unique_copy(ranges::view::all(ia), ib, ranges::equal_to(), &S::i);
        CHECK(r.in == ranges::end(ia));
        CHECK(r.out == ib + 7);
        check_equal(ranges::make_subrange(ib, ib+7), {S{1,1},S{2,2},S{3,3},S{4,5},S{5,6},S{6,9},S{7,10}});
    }
#ifndef RANGES_WORKAROUND_MSVC_573728
    {
        S const ia[] = {{1,1},{2,2},{3,3},{3,4},{4,5},{5,6},{5,7},{5,8},{6,9},{7,10}};
        S ib[ranges::size(ia)];
        auto r = ranges::unique_copy(std::move(ia), ib, ranges::equal_to(), &S::i);
        CHECK(::is_dangling(r.in));
        CHECK(r.out == ib + 7);
        check_equal(ranges::make_subrange(ib, ib+7), {S{1,1},S{2,2},S{3,3},S{4,5},S{5,6},S{6,9},S{7,10}});
    }
#endif // RANGES_WORKAROUND_MSVC_573728
    {
        std::vector<S> const ia{{1,1},{2,2},{3,3},{3,4},{4,5},{5,6},{5,7},{5,8},{6,9},{7,10}};
        S ib[10];
        RANGES_ENSURE(ranges::size(ia) == ranges::size(ib));
        auto r = ranges::unique_copy(std::move(ia), ib, ranges::equal_to(), &S::i);
        CHECK(::is_dangling(r.in));
        CHECK(r.out == ib + 7);
        check_equal(ranges::make_subrange(ib, ib+7), {S{1,1},S{2,2},S{3,3},S{4,5},S{5,6},S{6,9},S{7,10}});
    }

    return ::test_result();
}
コード例 #15
0
int test_main(int argc, char *argv[]) {

    //////////////////////////////////////////////////////////////////////////
    //[> Parameters <]

    //FIXME: use random sizes?
    const size_t n   = 100;
    const size_t m   = 50;
    const size_t n_s = 60;
    const size_t m_s = 30;

    //////////////////////////////////////////////////////////////////////////
    //[> Setup test <]
    namespace mpi = boost::mpi;

    El::Initialize(argc, argv);

    mpi::environment env(argc, argv);
    mpi::communicator world;
    const size_t rank = world.rank();

    MPI_Comm mpi_world(world);
    El::Grid grid(mpi_world);

    skylark::base::context_t context(0);

    dense_vc_star_matrix_t A_vc(grid);
    El::Uniform(A_vc, n, m);
    El::Zero(A_vc);

    sparse_vc_star_matrix_t A_sparse_vc(n, m, grid);

    double count = 1.0;
    for(int col = 0; col < A_vc.Width(); col++) {
        for(int row = 0; row < A_vc.Height(); row++) {
            A_vc.Update(row, col, count);
            A_sparse_vc.queue_update(row, col, count);
            count++;
        }
    }

    A_sparse_vc.finalize();

    // rowwise application
    //dense_vc_star_matrix_t pi_sketch_r(grid);

    //////////////////////////////////////////////////////////////////////////
    //[> Column wise application DistSparseMatrix -> DistMatrix[VC/*] <]

    typedef El::DistMatrix<double, El::VC, El::STAR> vcs_target_t;

    //[> 1. Create the sketching matrix <]
    test::util::hash_transform_test_t<sparse_vc_star_matrix_t, vcs_target_t>
        SparseVC(n, n_s, context);

    //[> 2. Create space for the sketched matrix <]
    vcs_target_t sketch_A_vcs(n_s, m, grid);
    El::Zero(sketch_A_vcs);

    //[> 3. Apply the transform <]
    SparseVC.apply(A_sparse_vc, sketch_A_vcs,
            skylark::sketch::columnwise_tag());

    //[> 4. Compute expected value using a GEMM <]
    El::DistMatrix<double> Pi_mcmr(n_s, n, grid);
    El::Zero(Pi_mcmr);
    compute_sketch_matrix(SparseVC, Pi_mcmr);

    El::DistMatrix<double> A_mcmr = A_vc;
    El::DistMatrix<double> C(n_s, m, grid);
    El::Gemm(El::NORMAL, El::NORMAL, 1.0, Pi_mcmr, A_mcmr, 0.0, C);

    El::DistMatrix<double, El::STAR, El::STAR> expected_A(n_s, m, grid);
    expected_A = C;
    El::DistMatrix<double, El::STAR, El::STAR> sketched_A(n_s, m, grid);
    sketched_A = sketch_A_vcs;
    check_equal(expected_A, sketched_A);

#if 0
    //////////////////////////////////////////////////////////////////////////
    //[> Row wise application DistSparseMatrix -> DistMatrix[VC/*] <]

    //[> 1. Create the sketching matrix <]
    test::util::hash_transform_test_t<sparse_vc_star_matrix_t, vcs_target_t>
        Sparse_r_vcs(m, m_s, context);

    //[> 2. Create space for the sketched matrix <]
    vcs_target_t sketch_A_r_vcs(n, m_s, grid);
    El::Zero(sketch_A_r_vcs);

    //[> 3. Apply the transform <]
    Sparse_r_vcs.apply(A, sketch_A_r_vcs, skylark::sketch::rowwise_tag());

    //[> 4. Build structure to compare <]
    // easier to check if all processors own result
    result = sketch_A_r_vcs;

    pi_sketch_r.Transpose();
    compute_sketch_matrix(Sparse_r_vcs, A, pi_sketch_r);
    pi_sketch_r.Transpose();
    expected_AR = Mult_AnXBn_Synch<PTDD, double, col_t>(
            A, pi_sketch_r, false, false);
#endif

    return 0;
}
コード例 #16
0
    TEST_FIXTURE(file_directory_test_base, directory_list_files_and_directories_with_prefix)
    {
        m_directory.create_if_not_exists(azure::storage::file_access_condition(), azure::storage::file_request_options(), m_context);

        auto prefix = _XPLATSTR("t") + get_random_string(3);
        auto dir_prefix = prefix + _XPLATSTR("dir");
        auto file_prefix = prefix + _XPLATSTR("file");
        auto exclude_prefix = _XPLATSTR("exclude");

        std::vector<azure::storage::cloud_file_directory> directories;
        std::vector<azure::storage::cloud_file> files;
        for (int i = 0; i < get_random_int32() % 3 + 1; ++i)
        {
            auto subdirectory = m_directory.get_subdirectory_reference(dir_prefix + utility::conversions::print_string(i));
            subdirectory.create();
            directories.push_back(subdirectory);

            auto file = m_directory.get_file_reference(file_prefix + utility::conversions::print_string(i));
            file.create(1);
            files.push_back(file);

            m_directory.get_subdirectory_reference(exclude_prefix + utility::conversions::print_string(i)).create();
        }

        int num_items_expected = directories.size() + files.size();
        int num_items_actual = 0;
        for (auto&& item : m_directory.list_files_and_directories(prefix))
        {
            ++num_items_actual;
            if (item.is_directory())
            {
                auto actual = item.as_directory();
                CHECK(actual.get_parent_share_reference().is_valid());
                check_equal(m_share, actual.get_parent_share_reference());
                
                auto it_found = std::find_if(directories.begin(), directories.end(), [&actual](const azure::storage::cloud_file_directory& expect)
                {
                    return actual.name() == expect.name();
                });
                CHECK(it_found != directories.end());
                check_equal(*it_found, actual);
                directories.erase(it_found);
            }
            else if (item.is_file())
            {
                auto actual = item.as_file();
                CHECK(actual.get_parent_share_reference().is_valid());
                check_equal(m_share, actual.get_parent_share_reference());

                auto it_found = std::find_if(files.begin(), files.end(), [&actual](const azure::storage::cloud_file& expect)
                {
                    return actual.name() == expect.name();
                });
                CHECK(it_found != files.end());
                check_equal(*it_found, actual);
                files.erase(it_found);
            }
        }

        CHECK_EQUAL(num_items_expected, num_items_actual);
        CHECK(directories.empty());
        CHECK(files.empty());
    }
コード例 #17
0
    TEST_FIXTURE(file_directory_test_base, directory_list_files_and_directories)
    {
        m_directory.create_if_not_exists(azure::storage::file_access_condition(), azure::storage::file_request_options(), m_context);

        azure::storage::list_file_and_diretory_result_iterator end_of_list;
        for (auto iter = m_share.get_root_directory_reference().list_files_and_directories(); iter != end_of_list; ++iter)
        {
            CHECK_EQUAL(iter->is_directory(), true);
            CHECK_EQUAL(iter->is_file(), false);
            auto directory = iter->as_directory();

            check_equal(directory, m_directory);

            CHECK(directory.get_parent_share_reference().is_valid());
            check_equal(m_share, directory.get_parent_share_reference());

            CHECK(!directory.uri().primary_uri().is_empty());
            CHECK(directory.metadata().empty());
            CHECK(directory.properties().etag().empty());

            CHECK(!directory.properties().last_modified().is_initialized());
        }

        // more complicated file structure.
        const size_t size = 2;
        std::vector<utility::string_t> directories;
        std::vector<utility::string_t> files;
        for (size_t i = 0; i < size; ++i)
        {
            directories.push_back(_XPLATSTR("directory") + get_random_string(10));
        }
        for (size_t i = 0; i < size; ++i)
        {
            files.push_back(_XPLATSTR("file") + get_random_string(10));
        }
        for (size_t i = 0; i < size; ++i)
        {
            auto directory = m_share.get_directory_reference(directories[i]);
            directory.create_if_not_exists(azure::storage::file_access_condition(), azure::storage::file_request_options(), m_context);

            for (size_t j = 0; j < size; ++j)
            {
                auto subdirectory = directory.get_subdirectory_reference(directories[j]);
                subdirectory.create_if_not_exists(azure::storage::file_access_condition(), azure::storage::file_request_options(), m_context);
                for (size_t k = 0; k < size; ++k)
                {
                    auto file = subdirectory.get_file_reference(files[k]);
                    file.create_if_not_exists(512U, azure::storage::file_access_condition(), azure::storage::file_request_options(), m_context);
                }
            }
            for (size_t j = 0; j < size; ++j)
            {
                auto file = directory.get_file_reference(files[j]);
                file.create_if_not_exists(512U, azure::storage::file_access_condition(), azure::storage::file_request_options(), m_context);
            }
            auto file = m_share.get_root_directory_reference().get_file_reference(files[i]);
            file.create_if_not_exists(512U, azure::storage::file_access_condition(), azure::storage::file_request_options(), m_context);
        }

        auto direcotries_one = directories;
        auto files_one = files;
        for (auto iter = m_share.get_root_directory_reference().list_files_and_directories(); iter != end_of_list; ++iter)
        {
            if (iter->is_directory())
            {
                auto directory2 = iter->as_directory();
                CHECK(directory2.get_parent_share_reference().is_valid());
                check_equal(m_share, directory2.get_parent_share_reference());
                CHECK(!directory2.uri().primary_uri().is_empty());
                CHECK(directory2.metadata().empty());
                CHECK(directory2.properties().etag().empty());
                CHECK(!directory2.properties().last_modified().is_initialized());

                auto found = false;
                for (auto directory_name = direcotries_one.begin(); directory_name != direcotries_one.end(); directory_name++)
                {
                    if (*directory_name == directory2.name())
                    {
                        direcotries_one.erase(directory_name);
                        found = true;
                        break;
                    }
                }

                auto direcotries_two = directories;
                auto files_two = files;
                for (auto iter2 = directory2.list_files_and_directories(); found && iter2 != end_of_list; ++iter2)
                {
                    if (iter2->is_directory())
                    {
                        auto directory3 = iter2->as_directory();
                        CHECK(directory3.get_parent_share_reference().is_valid());
                        check_equal(m_share, directory3.get_parent_share_reference());
                        CHECK(!directory3.uri().primary_uri().is_empty());
                        CHECK(directory3.metadata().empty());
                        CHECK(directory3.properties().etag().empty());
                        CHECK(!directory3.properties().last_modified().is_initialized());

                        for (auto directory_name = direcotries_two.begin(); directory_name != direcotries_two.end(); directory_name++)
                        {
                            if (*directory_name == directory3.name())
                            {
                                direcotries_two.erase(directory_name);
                                break;
                            }
                        }

                        auto files_three = files;
                        for (auto iter3 = directory3.list_files_and_directories(); iter3 != end_of_list; ++iter3)
                        {
                            CHECK(iter3->is_file());
                            auto file = iter3->as_file();
                            CHECK(file.get_parent_share_reference().is_valid());
                            check_equal(m_share, file.get_parent_share_reference());
                            CHECK(!file.uri().primary_uri().is_empty());
                            CHECK(file.metadata().empty());
                            CHECK(file.properties().etag().empty());
                            CHECK(!file.properties().last_modified().is_initialized());

                            for (auto file_name = files_three.begin(); file_name != files_three.end(); file_name++)
                            {
                                if (*file_name == file.name())
                                {
                                    files_three.erase(file_name);
                                    break;
                                }
                            }
                        }
                        CHECK(files_three.empty());
                    }
                    else if (iter2->is_file())
                    {
                        auto file = iter2->as_file();
                        CHECK(file.get_parent_share_reference().is_valid());
                        check_equal(m_share, file.get_parent_share_reference());
                        CHECK(!file.uri().primary_uri().is_empty());
                        CHECK(file.metadata().empty());
                        CHECK(file.properties().etag().empty());
                        CHECK(!file.properties().last_modified().is_initialized());

                        for (auto file_name = files_two.begin(); file_name != files_two.end(); file_name++)
                        {
                            if (*file_name == file.name())
                            {
                                files_two.erase(file_name);
                                break;
                            }
                        }
                    }

                }
                CHECK(!found || direcotries_two.empty());
                CHECK(!found || files_two.empty());
            }
            else if (iter->is_file())
            {
                auto file = iter->as_file();
                CHECK(file.get_parent_share_reference().is_valid());
                check_equal(m_share, file.get_parent_share_reference());
                CHECK(!file.uri().primary_uri().is_empty());
                CHECK(file.metadata().empty());
                CHECK(file.properties().etag().empty());
                CHECK(!file.properties().last_modified().is_initialized());

                for (auto file_name = files_one.begin(); file_name != files_one.end(); file_name++)
                {
                    if (*file_name == file.name())
                    {
                        files_one.erase(file_name);
                        break;
                    }
                }
            }
        }

        CHECK(direcotries_one.empty());
        CHECK(files_one.empty());
    }
コード例 #18
0
ファイル: rtest.cpp プロジェクト: rioki/rtest
 void check_equal(const char* a, const std::string& b, const char* file, unsigned int line)
 {
     check_equal(a, b.c_str(), file, line);
 }
コード例 #19
0
ファイル: generate.cpp プロジェクト: ericniebler/range-v3
int main()
{
    // Test for constant generator functions
    {
        int i = 0, j = 1;
        auto fib = view::generate([&]()->int{int tmp = i; i += j; std::swap(i, j); return tmp;});
        CPP_assert(ranges::InputView<decltype(fib)>);
        check_equal(fib | view::take_exactly(10), {0,1,1,2,3,5,8,13,21,34});
    }

    // Test for mutable-only generator functions
    {
        int i = 0, j = 1;
        auto fib = view::generate([=]()mutable->int{int tmp = i; i += j; std::swap(i, j); return tmp;});
        CPP_assert(ranges::InputView<decltype(fib)>);
        check_equal(fib | view::take_exactly(10), {0,1,1,2,3,5,8,13,21,34});
        // The generator cannot be called when it's const-qualified, so "fib const"
        // does not model View.
        CPP_assert(!ranges::View<decltype(fib) const>);
    }

    // Test for generator functions that return move-only types
    // https://github.com/ericniebler/range-v3/issues/905
    {
        char str[] = "gi";
        auto rng = view::generate([&]{str[0]++; return MoveOnlyString{str};}) | view::take_exactly(2);
        auto i = rng.begin();
        CHECK(bool(*i == MoveOnlyString{"hi"}));
        CHECK(bool(*i == MoveOnlyString{"hi"}));
        CHECK(bool(*rng.begin() == MoveOnlyString{"hi"}));
        CHECK(bool(*rng.begin() == MoveOnlyString{"hi"}));
        CPP_assert(ranges::InputView<decltype(rng)>);
        check_equal(rng, {MoveOnlyString{"hi"}, MoveOnlyString{"ii"}});
        static_assert(std::is_same<ranges::range_reference_t<decltype(rng)>, MoveOnlyString &&>::value, "");
    }

    // Test for generator functions that return internal references
    // https://github.com/ericniebler/range-v3/issues/807
    {
        int i = 42;
        auto rng = view::generate([i]{return &i;});
        auto rng2 = std::move(rng);
        auto it = rng2.begin();
        auto p = *it;
        auto p2 = *++it;
        CHECK(p == p2);
    }

    // Test that we only call the function once for each dereferenceable position
    // https://github.com/ericniebler/range-v3/issues/819
    {
        int i = 0;
        auto rng = view::generate([&i]{return ++i;});
        auto rng2 = std::move(rng);
        auto it = rng2.begin();
        CHECK(i == 0);
        CHECK(*it == 1);
        CHECK(i == 1);
        ++it;
        CHECK(i == 1);
        CHECK(*it == 2);
        CHECK(i == 2);
    }

    return test_result();
}
コード例 #20
0
 void operator() ()
 {
     section("simple debruijn test based on the example data in the paper");
     std::string test = "TACGTCGACGACT";
     std::string alphabet = "$ACGT";
     const char * i = test.c_str();
     std::vector<std::string> kmers;
     std::string kmer("$$$$");
     
     while (*i)
     {
         // shift kmer to the left by one
         kmer.erase(0,1);
         
         // append the next nucleotide
         kmer.push_back(*i);
         
         // and store
         kmers.push_back(kmer);
         i++;
     }
     
     // and shift it once more and add the $
     kmer.erase(0,1);
     kmer.push_back('$');
     kmers.push_back(kmer);
     
     // build the graph!
     debruijn_succinct db(4,alphabet,kmers.begin(),kmers.end());
             
     // and .. test it
     check_equal(5UL, db.forward(2), "forward(2)");
     check_equal(2UL, db.backward(5), "backward(5)");
     check_equal(7UL, db.backward(1), "backward(1)");
     check_equal(3UL, db.backward(7), "backward(1)");
     check_equal(db.no_node, db.backward(0), "backward(1)");
     
     check_equal(2, db.outdegree(6), "outdegree(6)");
     check_equal(1, db.outdegree(0), "outdegree(0)");
     check_equal(12UL, db.forward(8), "forward(8)");
     check_equal(10UL, db.outgoing(6,'T'), "outgoing(6,T)");
     const unsigned long forward_expected[13] = 
     {
         10, //0 $$$T -> $$TA
         4,  //1 CGAC -> GACT
         5,  //2 $TAC -> TACG-
         8,  //3 GACG -> ACGT
         11, //4 GACT -> ACT$
         
         8,  //5 TACG- -> ACGT
         9,  //6 GTCG -> TCGA-
         1,  //7 ACGA -> CGAC   
         12, //8 ACGT -> CGTC
         1,  //9 TCGA -> CGAC
         2, //10 $$TA -> $TAC
         (unsigned long)-1,//11 ACT$ -> -1
         6, //12 CGTC -> GTCG
     };
     for (int i = 0; i < 13;i ++)
         check_equal(forward_expected[i], db.forward(i), "forward(i)");
     check_equal(std::string("$$$"), db.label(0), "label(0)");
     check_equal(std::string("CGA"), db.label(1), "label(1)");
     check_equal(std::string("$TA"), db.label(2), "label(2)");
     check_equal(std::string("GAC"), db.label(3), "label(3)");
     check_equal(std::string("TAC"), db.label(4), "label(4)");
     check_equal(std::string("GTC"), db.label(5), "label(5)");
     check_equal(std::string("ACG"), db.label(6), "label(6)");
     check_equal(std::string("TCG"), db.label(7), "label(7)");
     check_equal(std::string("$$T"), db.label(8), "label(8)");
     check_equal(std::string("ACT"), db.label(9), "label(9)");
     check_equal(std::string("CGT"), db.label(10), "label(10)");
     
     check_equal(0,db.indegree(0), "indegree(0)");
     check_equal(2,db.indegree(1), "indegree(1)");
     check_equal(2,db.indegree(6), "indegree(6)");
     check_equal(1,db.indegree(2), "indegree(2)");
     
     check_equal(4UL,db.incoming(6,'T'), "incoming(6,T)");
     
     check_equal(11UL, db.num_nodes(), "num_nodes");
     
     section("test succinct against basic debruijn");
     debruijn_basic db_basic(4,kmers.begin(),kmers.end());
     debruijn_comparer dc(db_basic,db,alphabet);
     dc.run(this);
    
 }
コード例 #21
0
ファイル: tdiv.c プロジェクト: Distrotech/mpfr
static int
mpfr_all_div (mpfr_ptr a, mpfr_srcptr b, mpfr_srcptr c, mpfr_rnd_t r)
{
  mpfr_t a2;
  unsigned int oldflags, newflags;
  int inex, inex2;

  oldflags = __gmpfr_flags;
  inex = mpfr_div (a, b, c, r);

  if (a == b || a == c)
    return inex;

  newflags = __gmpfr_flags;

  mpfr_init2 (a2, MPFR_PREC (a));

  if (mpfr_integer_p (b) && ! (MPFR_IS_ZERO (b) && MPFR_IS_NEG (b)))
    {
      /* b is an integer, but not -0 (-0 is rejected as
         it becomes +0 when converted to an integer). */
      if (mpfr_fits_ulong_p (b, MPFR_RNDA))
        {
          __gmpfr_flags = oldflags;
          inex2 = mpfr_ui_div (a2, mpfr_get_ui (b, MPFR_RNDN), c, r);
          MPFR_ASSERTN (SAME_SIGN (inex2, inex));
          MPFR_ASSERTN (__gmpfr_flags == newflags);
          check_equal (a, a2, "mpfr_ui_div", b, c, r);
        }
      if (mpfr_fits_slong_p (b, MPFR_RNDA))
        {
          __gmpfr_flags = oldflags;
          inex2 = mpfr_si_div (a2, mpfr_get_si (b, MPFR_RNDN), c, r);
          MPFR_ASSERTN (SAME_SIGN (inex2, inex));
          MPFR_ASSERTN (__gmpfr_flags == newflags);
          check_equal (a, a2, "mpfr_si_div", b, c, r);
        }
    }

  if (mpfr_integer_p (c) && ! (MPFR_IS_ZERO (c) && MPFR_IS_NEG (c)))
    {
      /* c is an integer, but not -0 (-0 is rejected as
         it becomes +0 when converted to an integer). */
      if (mpfr_fits_ulong_p (c, MPFR_RNDA))
        {
          __gmpfr_flags = oldflags;
          inex2 = mpfr_div_ui (a2, b, mpfr_get_ui (c, MPFR_RNDN), r);
          MPFR_ASSERTN (SAME_SIGN (inex2, inex));
          MPFR_ASSERTN (__gmpfr_flags == newflags);
          check_equal (a, a2, "mpfr_div_ui", b, c, r);
        }
      if (mpfr_fits_slong_p (c, MPFR_RNDA))
        {
          __gmpfr_flags = oldflags;
          inex2 = mpfr_div_si (a2, b, mpfr_get_si (c, MPFR_RNDN), r);
          MPFR_ASSERTN (SAME_SIGN (inex2, inex));
          MPFR_ASSERTN (__gmpfr_flags == newflags);
          check_equal (a, a2, "mpfr_div_si", b, c, r);
        }
    }

  mpfr_clear (a2);

  return inex;
}
コード例 #22
0
ファイル: check-qobject.c プロジェクト: CRYP706URU/pyrebox
static void qobject_is_equal_dict_test(void)
{
    Error *local_err = NULL;
    QDict *dict_0, *dict_1, *dict_cloned;
    QDict *dict_different_key, *dict_different_value, *dict_different_null_key;
    QDict *dict_longer, *dict_shorter, *dict_nested;
    QDict *dict_crumpled;

    dict_0 = qdict_new();
    dict_1 = qdict_new();
    dict_different_key = qdict_new();
    dict_different_value = qdict_new();
    dict_different_null_key = qdict_new();
    dict_longer = qdict_new();
    dict_shorter = qdict_new();
    dict_nested = qdict_new();

    qdict_put_int(dict_0, "f.o", 1);
    qdict_put_int(dict_0, "bar", 2);
    qdict_put_int(dict_0, "baz", 3);
    qdict_put_null(dict_0, "null");

    qdict_put_int(dict_1, "f.o", 1);
    qdict_put_int(dict_1, "bar", 2);
    qdict_put_int(dict_1, "baz", 3);
    qdict_put_null(dict_1, "null");

    qdict_put_int(dict_different_key, "F.o", 1);
    qdict_put_int(dict_different_key, "bar", 2);
    qdict_put_int(dict_different_key, "baz", 3);
    qdict_put_null(dict_different_key, "null");

    qdict_put_int(dict_different_value, "f.o", 42);
    qdict_put_int(dict_different_value, "bar", 2);
    qdict_put_int(dict_different_value, "baz", 3);
    qdict_put_null(dict_different_value, "null");

    qdict_put_int(dict_different_null_key, "f.o", 1);
    qdict_put_int(dict_different_null_key, "bar", 2);
    qdict_put_int(dict_different_null_key, "baz", 3);
    qdict_put_null(dict_different_null_key, "none");

    qdict_put_int(dict_longer, "f.o", 1);
    qdict_put_int(dict_longer, "bar", 2);
    qdict_put_int(dict_longer, "baz", 3);
    qdict_put_int(dict_longer, "xyz", 4);
    qdict_put_null(dict_longer, "null");

    qdict_put_int(dict_shorter, "f.o", 1);
    qdict_put_int(dict_shorter, "bar", 2);
    qdict_put_int(dict_shorter, "baz", 3);

    qdict_put(dict_nested, "f", qdict_new());
    qdict_put_int(qdict_get_qdict(dict_nested, "f"), "o", 1);
    qdict_put_int(dict_nested, "bar", 2);
    qdict_put_int(dict_nested, "baz", 3);
    qdict_put_null(dict_nested, "null");

    dict_cloned = qdict_clone_shallow(dict_0);

    check_equal(dict_0, dict_1, dict_cloned);
    check_unequal(dict_0, dict_different_key, dict_different_value,
                  dict_different_null_key, dict_longer, dict_shorter,
                  dict_nested);

    dict_crumpled = qobject_to(QDict, qdict_crumple(dict_1, &local_err));
    g_assert(!local_err);
    check_equal(dict_crumpled, dict_nested);

    qdict_flatten(dict_nested);
    check_equal(dict_0, dict_nested);

    /* Containing an NaN value will make this dict compare unequal to
     * itself */
    qdict_put(dict_0, "NaN", qnum_from_double(NAN));
    g_assert(qobject_is_equal(QOBJECT(dict_0), QOBJECT(dict_0)) == false);

    free_all(dict_0, dict_1, dict_cloned, dict_different_key,
             dict_different_value, dict_different_null_key, dict_longer,
             dict_shorter, dict_nested, dict_crumpled);
}
コード例 #23
0
ファイル: TestUtil.hpp プロジェクト: chrismullins/moab
void check_equal( const std::string& A, const std::string& B, const char* sA, const char* sB, int line, const char* file )
  {  check_equal( A.c_str(), B.c_str(), sA, sB, line, file); }
コード例 #24
0
ファイル: type_check.cpp プロジェクト: lucciano/modelica-cc
Type TypeCheck_::check_expression(AST_Expression e)
{
  Type ct,t1,t2,t;
  switch (e->expressionType()) {
  case EXPBINOP:
  {
    AST_Expression_BinOp b = e->getAsBinOp();
    return check_binop(b->left() , b->right() , b->binopType());
  }
  case EXPUMINUS:
  {
    AST_Expression_UMinus b = e->getAsUMinus();
    t = check_expression(b->exp());
    if ( check_equal(t , T("Integer")) or check_equal(t , T("Real")) ) return t;
    throw "Type Error (3)";
  }

  case EXPOUTPUT :
  {
    AST_Expression_Output b = e->getAsOutput();
    return check_expression(b->expressionList()->front() );
  }

  case EXPIF:
  {
    AST_Expression_If b = e->getAsIf();
    ct = check_expression(b->condition() );
    t1 = check_expression(b->then() );
    t2 = check_expression(b->else_exp()); // Falta el elseIF
    if ( !check_equal(ct, T("Boolean")) ) throw "Type Error (4)";
    if ( !check_equal(t1,t2) ) throw "Type Error (5)";
    return t1;

  }

  case EXPCALL:
  {
    // Añadir las funciones en la listaaaa de variables
    AST_Expression_Call c = e->getAsCall();
    if ( toStr(c->name()) == "sample" ) return  T("Boolean");
    if ( toStr(c->name()) == "pre" ) 		
		return  check_expression(c->arguments()->front());
	return T("Real");
  }

  case EXPCOMPREF:
  {
    AST_Expression_ComponentReference b = e->getAsComponentReference();

    VarInfo  tt = varEnv->lookup(  toStr(b->names()->front()) );

    if (tt == NULL) {
      cerr << "Var:" <<  b->names()->front() << ":";
      throw "Variable no existe (8)";
    }
    if (b->indexes()->front()->size() == 0)
      return tt->type();
    else {
      Type t = tt->type();
      AST_ExpressionListIterator exit;
      foreach(exit , b->indexes()->front() )
      if (t->getType() == TYARRAY)
        t = t->getAsArray()->arrayOf();
      else throw "Type Error (7)";
      return t;
    }

    break;
  }
  case EXPDERIVATIVE:
    return T("Real");
  case EXPBOOLEAN:
    return T("Boolean");
  case EXPSTRING:
    return T("String");
  case EXPREAL:
    return T("Real");
  case EXPINTEGER:
    return T("Integer");
  case EXPBOOLEANNOT:
  {
    AST_Expression_BooleanNot b = e->getAsBooleanNot();
    t = check_expression(b->exp());
    if ( !check_equal(t, T("Boolean")) ) throw "Type Error (6)";
    return t;
  }
  default:
    throw "No implrementado aun! (check_expression)";

  }
}