File indexing completed on 2024-05-12 05:09:56
0001 /*************************************************************************** 0002 Copyright (C) 2012 Robby Stephenson <robby@periapsis.org> 0003 ***************************************************************************/ 0004 0005 /*************************************************************************** 0006 * * 0007 * This program is free software; you can redistribute it and/or * 0008 * modify it under the terms of the GNU General Public License as * 0009 * published by the Free Software Foundation; either version 2 of * 0010 * the License or (at your option) version 3 or any later version * 0011 * accepted by the membership of KDE e.V. (or its successor approved * 0012 * by the membership of KDE e.V.), which shall act as a proxy * 0013 * defined in Section 14 of version 3 of the license. * 0014 * * 0015 * This program is distributed in the hope that it will be useful, * 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0018 * GNU General Public License for more details. * 0019 * * 0020 * You should have received a copy of the GNU General Public License * 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 0022 * * 0023 ***************************************************************************/ 0024 0025 #undef QT_NO_CAST_FROM_ASCII 0026 0027 #include "dblpfetchertest.h" 0028 0029 #include "../fetch/dblpfetcher.h" 0030 #include "../collections/bibtexcollection.h" 0031 #include "../collectionfactory.h" 0032 #include "../entry.h" 0033 #include "../utils/datafileregistry.h" 0034 0035 #include <QTest> 0036 0037 QTEST_GUILESS_MAIN( DBLPFetcherTest ) 0038 0039 DBLPFetcherTest::DBLPFetcherTest() : AbstractFetcherTest() { 0040 } 0041 0042 void DBLPFetcherTest::initTestCase() { 0043 Tellico::RegisterCollection<Tellico::Data::BibtexCollection> registerBibtex(Tellico::Data::Collection::Bibtex, "bibtex"); 0044 Tellico::DataFileRegistry::self()->addDataLocation(QFINDTESTDATA("../../xslt/dblp2tellico.xsl")); 0045 } 0046 0047 void DBLPFetcherTest::testProceedings() { 0048 Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Bibtex, Tellico::Fetch::Keyword, 0049 QStringLiteral("Chip and PIN is Broken")); 0050 Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::DBLPFetcher(this)); 0051 0052 Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); 0053 0054 QCOMPARE(results.size(), 1); 0055 0056 Tellico::Data::EntryPtr entry = results.at(0); 0057 QCOMPARE(entry->field(QStringLiteral("title")), QStringLiteral("Chip and PIN is Broken.")); 0058 QCOMPARE(entry->field(QStringLiteral("author")), QStringLiteral("Steven J. Murdoch; Saar Drimer; Ross J. Anderson; Mike Bond")); 0059 QCOMPARE(entry->field(QStringLiteral("year")), QStringLiteral("2010")); 0060 QCOMPARE(entry->field(QStringLiteral("pages")), QStringLiteral("433-446")); 0061 QCOMPARE(entry->field(QStringLiteral("booktitle")), QStringLiteral("IEEE Symposium on Security and Privacy")); 0062 QCOMPARE(entry->field(QStringLiteral("journal")), QString()); 0063 QCOMPARE(entry->field(QStringLiteral("url")), QStringLiteral("https://dblp.org/rec/conf/sp/MurdochDAB10")); 0064 // QCOMPARE(entry->field(QStringLiteral("doi")), QStringLiteral("10.1109/SP.2010.33")); 0065 QCOMPARE(entry->field(QStringLiteral("entry-type")), QStringLiteral("inproceedings")); 0066 QCOMPARE(entry->field(QStringLiteral("bibtex-key")), QStringLiteral("MurdochDAB10")); 0067 } 0068 0069 void DBLPFetcherTest::testArticle() { 0070 Tellico::Fetch::FetchRequest request(Tellico::Data::Collection::Bibtex, Tellico::Fetch::Keyword, 0071 QStringLiteral("Nontrivial independent sets of bipartite graphs")); 0072 Tellico::Fetch::Fetcher::Ptr fetcher(new Tellico::Fetch::DBLPFetcher(this)); 0073 0074 Tellico::Data::EntryList results = DO_FETCH1(fetcher, request, 1); 0075 0076 QCOMPARE(results.size(), 1); 0077 0078 Tellico::Data::EntryPtr entry = results.at(0); 0079 QCOMPARE(entry->field(QStringLiteral("title")), QStringLiteral("Nontrivial independent sets of bipartite graphs and cross-intersecting families.")); 0080 QCOMPARE(entry->field(QStringLiteral("author")), QStringLiteral("Jun Wang; Huajun Zhang")); 0081 QCOMPARE(entry->field(QStringLiteral("year")), QStringLiteral("2013")); 0082 QCOMPARE(entry->field(QStringLiteral("pages")), QStringLiteral("129-141")); 0083 QCOMPARE(entry->field(QStringLiteral("volume")), QStringLiteral("120")); 0084 QCOMPARE(entry->field(QStringLiteral("number")), QStringLiteral("1")); 0085 QCOMPARE(entry->field(QStringLiteral("journal")), QStringLiteral("J. Comb. Theory, Ser. A")); 0086 QCOMPARE(entry->field(QStringLiteral("booktitle")), QString()); 0087 QCOMPARE(entry->field(QStringLiteral("url")), QStringLiteral("https://dblp.org/rec/journals/jct/WangZ13")); 0088 // QCOMPARE(entry->field(QStringLiteral("doi")), QStringLiteral("10.1016/j.jcta.2012.07.005")); 0089 QCOMPARE(entry->field(QStringLiteral("entry-type")), QStringLiteral("article")); 0090 QCOMPARE(entry->field(QStringLiteral("bibtex-key")), QStringLiteral("WangZ13")); 0091 }