transport: empty test for sqlite converter
[abstract.git] / sql / test / aaSqlTestModule.cpp
blob48d1fe0f292bd1f1cb70c7b8e6c0ef0c4fd380c3
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent tw=79 ft=cpp: */
3 /*
4 * Copyright (C) 2008 Sergey Yanovich <ynvich@gmail.com>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public
17 * License along with this program; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #include "xpcom-config.h"
24 #include "nsIGenericFactory.h"
25 #include "nsStringAPI.h"
27 /* Unfrozen API */
28 #include "nsIStringEnumerator.h"
29 #include "nsITest.h"
30 #include "nsITestRunner.h"
32 /* Project includes */
33 #include "aaSqliteTest.h"
34 #include "aaEntitySqlTest.h"
36 #define AA_SQL_TEST_MODULE_CID \
37 {0xd1809dce, 0x036f, 0x44b8, {0xb7, 0x45, 0x1e, 0x63, 0x17, 0x9e, 0xa4, 0xf4}}
38 #define AA_SQL_TEST_MODULE_CONTRACT "@aasii.org/sql/unit;1"
40 class aaSqlTestModule: public nsITest,
41 public nsIUTF8StringEnumerator
43 public:
44 aaSqlTestModule() :mSubtest(0) {;}
45 NS_DECL_ISUPPORTS
46 NS_DECL_NSITEST
47 NS_DECL_NSIUTF8STRINGENUMERATOR
48 private:
49 ~aaSqlTestModule() {;}
50 PRUint32 mSubtest;
53 NS_IMPL_ISUPPORTS2(aaSqlTestModule,
54 nsITest,
55 nsIUTF8StringEnumerator)
57 NS_IMETHODIMP
58 aaSqlTestModule::Test(nsITestRunner *aTestRunner)
60 return NS_OK;
63 /* nsIUTF8StringEnumerator */
64 static const char* sqlSubtests[] =
66 "@aasii.org/sql/unit-base;1"
67 ,"@aasii.org/sql/unit-sqlite;1"
69 #define sqlSubtestCount (sizeof(sqlSubtests) / sizeof(char*))
71 NS_IMETHODIMP
72 aaSqlTestModule::HasMore(PRBool *aHasMore)
74 NS_ENSURE_ARG_POINTER(aHasMore);
75 *aHasMore = (mSubtest < sqlSubtestCount);
76 return NS_OK;
79 NS_IMETHODIMP
80 aaSqlTestModule::GetNext(nsACString &aContractID)
82 NS_ENSURE_TRUE(mSubtest < sqlSubtestCount, NS_ERROR_FAILURE);
83 aContractID.Assign(sqlSubtests[mSubtest++]);
84 return NS_OK;
87 /* Module and Factory code */
88 NS_GENERIC_FACTORY_CONSTRUCTOR(aaSqlTestModule)
89 NS_GENERIC_FACTORY_CONSTRUCTOR(aaSqliteTest)
90 NS_GENERIC_FACTORY_CONSTRUCTOR(aaEntitySqlTest)
92 static const nsModuleComponentInfo kComponents[] =
94 { "Sql Module Test Container",
95 AA_SQL_TEST_MODULE_CID,
96 AA_SQL_TEST_MODULE_CONTRACT,
97 aaSqlTestModuleConstructor}
98 ,{"Sqlite Test Container",
99 AA_SQLITE_TEST_CID,
100 AA_SQLITE_TEST_CONTRACT,
101 aaSqliteTestConstructor}
102 ,{"Sql Test for Entity",
103 AA_SQL_TEST_ENTITY_CID,
104 AA_SQL_TEST_ENTITY_CONTRACT,
105 aaEntitySqlTestConstructor}
107 NS_IMPL_NSGETMODULE(aaSqlTest, kComponents)