Example #1
0
void tst_QXmlSchema::copyConstructor() const
{
    /* Verify that we can take a const reference, and simply do a copy of a default constructed object. */
    {
        const QXmlSchema schema1;
        QXmlSchema schema2(schema1);
    }

    /* Copy twice. */
    {
        const QXmlSchema schema1;
        QXmlSchema schema2(schema1);
        QXmlSchema schema3(schema2);
    }

    /* Verify that copying default values works. */
    {
        const QXmlSchema schema1;
        const QXmlSchema schema2(schema1);
        QCOMPARE(schema2.messageHandler(), schema1.messageHandler());
        QCOMPARE(schema2.uriResolver(), schema1.uriResolver());
        QCOMPARE(schema2.networkAccessManager(), schema1.networkAccessManager());
        QCOMPARE(schema2.isValid(), schema1.isValid());
    }
}
TEST_F(TupleSchemaTests, TupleSchemaTest) {
  std::vector<catalog::Column> columns;

  catalog::Column column1(VALUE_TYPE_INTEGER, GetTypeSize(VALUE_TYPE_INTEGER),
                          "A", true);
  catalog::Column column2(VALUE_TYPE_INTEGER, GetTypeSize(VALUE_TYPE_INTEGER),
                          "B", true);
  catalog::Column column3(VALUE_TYPE_TINYINT, GetTypeSize(VALUE_TYPE_TINYINT),
                          "C", true);
  catalog::Column column4(VALUE_TYPE_VARCHAR, 24, "D", false);

  columns.push_back(column1);
  columns.push_back(column2);
  columns.push_back(column3);
  columns.push_back(column4);

  catalog::Schema schema1(columns);
  LOG_INFO("%s", schema1.GetInfo().c_str());

  catalog::Schema schema2(columns);
  EXPECT_EQ(schema1, schema2);

  std::vector<oid_t> subset{0, 2};
  catalog::Schema *schema3 = catalog::Schema::CopySchema(&schema2, subset);
  LOG_INFO("%s", schema3->GetInfo().c_str());

  EXPECT_NE(schema1, (*schema3));

  delete schema3;
}
/**
 * @brief Creates simple tile group for testing purposes.
 * @param backend Backend for tile group to use.
 * @param tuple_count Tuple capacity of this tile group.
 *
 * Tile group has two tiles, and each of them has two columns.
 * The first two columns have INTEGER types, the last two have TINYINT
 * and VARCHAR.
 *
 * IMPORTANT: If you modify this function, it is your responsibility to
 *            fix any affected test cases. Test cases may be depending
 *            on things like the specific number of tiles in this group.
 *
 * @return Pointer to tile group.
 */
storage::TileGroup *ExecutorTestsUtil::CreateTileGroup(int tuple_count) {
  std::vector<catalog::Column> columns;
  std::vector<catalog::Schema> schemas;

  columns.push_back(GetColumnInfo(0));
  columns.push_back(GetColumnInfo(1));
  catalog::Schema schema1(columns);
  schemas.push_back(schema1);

  columns.clear();
  columns.push_back(GetColumnInfo(2));
  columns.push_back(GetColumnInfo(3));

  catalog::Schema schema2(columns);
  schemas.push_back(schema2);

  std::map<oid_t, std::pair<oid_t, oid_t>> column_map;
  column_map[0] = std::make_pair(0, 0);
  column_map[1] = std::make_pair(0, 1);
  column_map[2] = std::make_pair(1, 0);
  column_map[3] = std::make_pair(1, 1);

  storage::TileGroup *tile_group = storage::TileGroupFactory::GetTileGroup(
      INVALID_OID, INVALID_OID,
      TestingHarness::GetInstance().GetNextTileGroupId(), nullptr, schemas,
      column_map, tuple_count);

  return tile_group;
}
Example #4
0
//funzione che controlla a che tipo di schema corrisponde la parola e agisce di conseguenza
char * onesillaba(char *s){
   char* vet;
   if(schema1(s))
      vet=silschema1(s);
   else if(schema2(s))
      vet=silschema2(s);
   return vet;
}
Example #5
0
void tst_QXmlSchema::copyMutationTest() const
{
    QXmlSchema schema1;
    QXmlSchema schema2(schema1);

    // check that everything is equal
    QVERIFY(schema2.messageHandler() == schema1.messageHandler());
    QVERIFY(schema2.uriResolver() == schema1.uriResolver());
    QVERIFY(schema2.networkAccessManager() == schema1.networkAccessManager());

    MessageSilencer handler;
    const TestURIResolver resolver;
    QNetworkAccessManager manager;

    // modify schema1
    schema1.setMessageHandler(&handler);
    schema1.setUriResolver(&resolver);
    schema1.setNetworkAccessManager(&manager);

    // check that schema2 is not effected by the modifications of schema1
    QVERIFY(schema2.messageHandler() != schema1.messageHandler());
    QVERIFY(schema2.uriResolver() != schema1.uriResolver());
    QVERIFY(schema2.networkAccessManager() != schema1.networkAccessManager());

    // modify schema1 further
    const QByteArray data( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
                           "<xsd:schema"
                           "        xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\""
                           "        xmlns=\"http://qt.nokia.com/xmlschematest\""
                           "        targetNamespace=\"http://qt.nokia.com/xmlschematest\""
                           "        version=\"1.0\""
                           "        elementFormDefault=\"qualified\">"
                           "</xsd:schema>" );

    const QUrl documentUri("http://qt.nokia.com/xmlschematest");
    schema1.load(data, documentUri);

    QVERIFY(schema2.isValid() != schema1.isValid());
}