示例#1
0
文件: scan.c 项目: OpenHMR/libquvi
static void test_scan_userdata()
{
  static const gchar URL[] = "http://is.gd/yUeWit";

  struct user_data_s u;
  quvi_scan_t qs;
  quvi_t q;

  if (chk_internet() == FALSE || chk_skip(__func__) == TRUE)
    return;

  q = new_q();
  u.n = 0;

  quvi_set(q, QUVI_OPTION_CALLBACK_STATUS, (quvi_callback_status) status_cb);
  quvi_set(q, QUVI_OPTION_CALLBACK_STATUS_USERDATA, &u);

  g_assert_cmpint(u.n, ==, 0);
  qs = quvi_scan_new(q, URL);
  g_assert_cmpint(qerr_m(q, URL), ==, QUVI_OK);
  g_assert(qs != NULL);

  quvi_scan_free(qs);
  quvi_free(q);

  g_assert_cmpint(u.n, >, 0);
}
示例#2
0
文件: scan.c 项目: OpenHMR/libquvi
static void test_scan_noresults()
{
  static const gchar URL[] = "http://example.com/";

  quvi_scan_t qs;
  quvi_t q;

  if (chk_internet() == FALSE || chk_skip(__func__) == TRUE)
    return;

  q = new_q();

  qs = quvi_scan_new(q, URL);
  g_assert_cmpint(qerr_m(q, URL), ==, QUVI_OK);
  g_assert(qs != NULL);
  g_assert(quvi_scan_next_media_url(qs) == NULL);

  quvi_scan_free(qs);
  quvi_free(q);
}
示例#3
0
文件: scan.c 项目: OpenHMR/libquvi
static void test_scan_short()
{
  static const gchar URL[] = "http://is.gd/yUeWit";

  quvi_scan_t qs;
  quvi_t q;

  if (chk_internet() == FALSE || chk_skip(__func__) == TRUE)
    return;

  q = new_q();

  qs = quvi_scan_new(q, URL);
  g_assert_cmpint(qerr_m(q, URL), ==, QUVI_OK);
  g_assert(qs != NULL);
  chk_results(qs);

  quvi_scan_free(qs);
  quvi_free(q);
}
示例#4
0
void distribute_forall::reduce1_quantifier(quantifier * q) {
    // This transformation is applied after skolemization/quantifier elimination. So, all quantifiers are universal.
    SASSERT(q->is_forall());

    // This transformation is applied after basic pre-processing steps.
    // So, we can assume that
    //    1) All (and f1 ... fn) are already encoded as (not (or (not f1 ... fn)))
    //    2) All or-formulas are flat (or f1 (or f2 f3)) is encoded as (or f1 f2 f3)

    expr * e = get_cached(q->get_expr());
    if (m_manager.is_not(e) && m_manager.is_or(to_app(e)->get_arg(0))) {
        // found target for simplification
        // (forall X (not (or F1 ... Fn)))
        // -->
        // (and (forall X (not F1))
        //      ...
        //      (forall X (not Fn)))
        app * or_e        = to_app(to_app(e)->get_arg(0));
        unsigned num_args = or_e->get_num_args();
        expr_ref_buffer new_args(m_manager);
        for (unsigned i = 0; i < num_args; i++) {
            expr * arg = or_e->get_arg(i);
            expr_ref not_arg(m_manager);
            // m_bsimp.mk_not applies basic simplifications. For example, if arg is of the form (not a), then it will return a.
            m_bsimp.mk_not(arg, not_arg);
            quantifier_ref tmp_q(m_manager);
            tmp_q = m_manager.update_quantifier(q, not_arg);
            expr_ref new_q(m_manager);
            elim_unused_vars(m_manager, tmp_q, new_q);
            new_args.push_back(new_q);
        }
        expr_ref result(m_manager);
        // m_bsimp.mk_and actually constructs a (not (or ...)) formula, 
        // it will also apply basic simplifications.
        m_bsimp.mk_and(new_args.size(), new_args.c_ptr(), result);
        cache_result(q, result);
    }
    else {
        cache_result(q, m_manager.update_quantifier(q, e));
    }
}
示例#5
0
文件: scan.c 项目: OpenHMR/libquvi
static void test_scan_core()
{
  static const gchar URL[] =
    "http://screenrant.com/superman-man-steel-trailer/";

  quvi_scan_t qs;
  quvi_t q;

  if (chk_internet() == FALSE || chk_skip(__func__) == TRUE)
    return;

  q = new_q();

  qs = quvi_scan_new(q, URL);
  g_assert_cmpint(qerr_m(q, URL), ==, QUVI_OK);
  g_assert(qs != NULL);
  chk_results(qs);

  quvi_scan_free(qs);
  quvi_free(q);
}