transport: pass correct channel
[abstract.git] / accounting / test / aaAccountingTest.cpp
blob01ba696830dac666667169b50ae0ac2ea23681d8
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 <stdio.h>
25 #include "nsStringAPI.h"
26 #include "nsIGenericFactory.h"
27 #include "nsComponentManagerUtils.h"
29 /* Unfrozen API */
30 #include "nsTestUtils.h"
31 #include "nsITest.h"
32 #include "nsITestRunner.h"
34 /* Project includes */
35 #include "aaChartKeys.h"
36 #include "aaChart.h"
38 #define AA_ACCOUNTING_TEST_CID \
39 {0x59694add, 0xeec8, 0x43df, {0xb0, 0x85, 0xc8, 0x7b, 0x64, 0x71, 0xea, 0x7d}}
40 #define AA_ACCOUNTING_TEST_CONTRACT "@aasii.org/accounting/unit;1"
42 class aaAccountingTest: public nsITest
44 public:
45 aaAccountingTest() {;}
46 NS_DECL_ISUPPORTS
47 NS_DECL_NSITEST
48 private:
49 virtual ~aaAccountingTest() {;}
50 nsresult testChart(nsITestRunner *aTestRunner);
53 NS_IMETHODIMP
54 aaAccountingTest::Test(nsITestRunner *aTestRunner)
56 nsITestRunner *cxxUnitTestRunner = aTestRunner;
57 NS_TEST_ASSERT_OK(testChart(aTestRunner));
58 return NS_OK;
61 NS_IMPL_ISUPPORTS1(aaAccountingTest, nsITest)
63 NS_GENERIC_FACTORY_CONSTRUCTOR(aaAccountingTest)
65 static const nsModuleComponentInfo components[] =
67 { "Accounting Module Unit Test",
68 AA_ACCOUNTING_TEST_CID,
69 AA_ACCOUNTING_TEST_CONTRACT,
70 aaAccountingTestConstructor }
73 NS_IMPL_NSGETMODULE(aaAccountingTest, components)
75 /* Private methods */
76 nsresult
77 aaAccountingTest::testChart(nsITestRunner *aTestRunner)
79 NS_TEST_BEGIN( aTestRunner );
80 nsresult rv;
81 nsCOMPtr<aaIChart> chart(do_CreateInstance(AA_CHART_CONTRACT, &rv));
82 NS_TEST_ASSERT_MSG(chart, "aaChart instance creation" );
83 NS_ENSURE_SUCCESS(rv, rv);
84 nsCOMPtr<aaIDataNode> item(do_QueryInterface(chart, &rv));
85 NS_TEST_ASSERT_MSG(item, "aaChart aaIDataNode interface" );
86 NS_ENSURE_SUCCESS(rv, rv);
88 return NS_OK;