From 56f5bb1e8bd5f5a64b43fede3b8c297a5ca9cda8 Mon Sep 17 00:00:00 2001 From: Klaus Kaempf Date: Thu, 2 Feb 2006 22:30:47 +0000 Subject: [PATCH] - fix selection test case - add test for 'file not found' - add pattern parser test --- testsuite/source/tests/Makefile.am | 9 +- testsuite/source/tests/PatternTagParserTest.cc | 24 ++ testsuite/source/tests/SelectionTagParserTest.cc | 28 +++ testsuite/source/tests/SuseTagsTest.cc | 17 -- testsuite/source/tests/patfiles/default.pat | 280 +++++++++++++++++++++++ 5 files changed, 335 insertions(+), 23 deletions(-) create mode 100644 testsuite/source/tests/PatternTagParserTest.cc create mode 100644 testsuite/source/tests/SelectionTagParserTest.cc delete mode 100644 testsuite/source/tests/SuseTagsTest.cc create mode 100644 testsuite/source/tests/patfiles/default.pat diff --git a/testsuite/source/tests/Makefile.am b/testsuite/source/tests/Makefile.am index 24df131..b5e35c5 100644 --- a/testsuite/source/tests/Makefile.am +++ b/testsuite/source/tests/Makefile.am @@ -4,10 +4,7 @@ LDADD = $(top_srcdir)/zypp/lib@PACKAGE@.la -#noinst_PROGRAMS = yum - -#yum_SOURCES = yum.cc - -noinst_PROGRAMS = susetagstest -susetagstest_SOURCES = SuseTagsTest.cc +noinst_PROGRAMS = selectiontagparsertest patterntagparsertest +selectiontagparsertest_SOURCES = SelectionTagParserTest.cc +patterntagparsertest_SOURCES = PatternTagParserTest.cc diff --git a/testsuite/source/tests/PatternTagParserTest.cc b/testsuite/source/tests/PatternTagParserTest.cc new file mode 100644 index 0000000..e86e503 --- /dev/null +++ b/testsuite/source/tests/PatternTagParserTest.cc @@ -0,0 +1,24 @@ +#include +#include "zypp/source/susetags/PatternTagFileParser.h" +#include "zypp/base/Logger.h" +#include "zypp/base/Exception.h" +#include "zypp/Pathname.h" + +using namespace std; +using namespace zypp; + +int main() +{ + Pattern::Ptr pattern; + try { + pattern = zypp::source::susetags::parsePattern (Pathname("patfiles/default.pat")); + cout << *pattern << endl; + pattern = zypp::source::susetags::parsePattern (Pathname("patfiles/NOTTHERE.pat")); + cout << *pattern << endl; + } + catch (Exception & excpt_r) { + ZYPP_CAUGHT (excpt_r); + } + + return 0; +} diff --git a/testsuite/source/tests/SelectionTagParserTest.cc b/testsuite/source/tests/SelectionTagParserTest.cc new file mode 100644 index 0000000..1a106d7 --- /dev/null +++ b/testsuite/source/tests/SelectionTagParserTest.cc @@ -0,0 +1,28 @@ +#include +#include "zypp/source/susetags/SelectionTagFileParser.h" +#include "zypp/base/Logger.h" +#include "zypp/base/Exception.h" +#include "zypp/Pathname.h" + +using namespace std; +using namespace zypp; + +int main() +{ + Selection::Ptr selection; + + try { + selection = zypp::source::susetags::parseSelection (Pathname("selfiles/default.sel")); + cout << *selection << endl; + selection = zypp::source::susetags::parseSelection (Pathname("selfiles/Office.sel")); + cout << *selection << endl; + selection = zypp::source::susetags::parseSelection (Pathname("selfiles/X11.sel")); + cout << *selection << endl; + selection = zypp::source::susetags::parseSelection (Pathname("selfiles/NOTTHERE.sel")); + cout << *selection << endl; + } + catch (Exception & excpt_r) { + ZYPP_CAUGHT (excpt_r); + } + return 0; +} diff --git a/testsuite/source/tests/SuseTagsTest.cc b/testsuite/source/tests/SuseTagsTest.cc deleted file mode 100644 index d1c3a1f..0000000 --- a/testsuite/source/tests/SuseTagsTest.cc +++ /dev/null @@ -1,17 +0,0 @@ - -#include -#include -#include - -using namespace zypp; -using namespace zypp::source::susetags; - -int main() -{ - SelectionSelFileParser parser; - SelectionSelFileParser::SelectionEntry entry; - - parser.parse(Pathname("selfiles/default.sel"), entry); - DBG << "==============================================================" << std::endl; - return 0; -} diff --git a/testsuite/source/tests/patfiles/default.pat b/testsuite/source/tests/patfiles/default.pat new file mode 100644 index 0000000..f2746bd --- /dev/null +++ b/testsuite/source/tests/patfiles/default.pat @@ -0,0 +1,280 @@ +# SuSE-Linux-Pattern default 10.0-61.noarch -- (c) 2004 SuSE Linux AG +# Needs parser version 4.0 or greater +# generated on Mon Sep 12 10:40:39 UTC 2005 + +=Ver: 1.0 + +=Pat: default 10.0 61 noarch + +=Sum: Standard Pattern with KDE +=Sum.bg: Стандартна система с KDE +=Sum.cs: Standardní systém s KDE +=Sum.da: Standardsystem med KDE +=Sum.de: Standardsystem mit KDE +=Sum.el: Κανονικό Σύστημα με KDE +=Sum.en: Standard System with KDE +=Sum.es: Sistema estándar con KDE +=Sum.fr: Système standard avec KDE +=Sum.gl: Standard System with KDE +=Sum.hu: Alaprendszer és KDE +=Sum.it: Sistema standard con KDE +=Sum.ja: KDEを搭載した標準システム +=Sum.ko: Standard System with KDE +=Sum.lt: Įprasta sistema su KDE +=Sum.nl: Standaardsysteem met KDE +=Sum.no: Standaardsysteem met KDE +=Sum.pl: Standardowy system z KDE +=Sum.pt: Sistema Standard com KDE +=Sum.pt_BR: Sistema Padrão com KDE +=Sum.ru: Standard System with KDE +=Sum.sk: Standard System with KDE +=Sum.sl: Standardni sistem s KDE +=Sum.sv: Standard System with KDE +=Sum.zh_CN: 带有 KDE 的标准系统 +=Sum.zh_TW: 標準系統與 KDE + ++Rec: +Kde-Desktop +SuSE-Documentation +-Rec: + ++Req: +Min +X11 +-Req: + ++Con: +Minimal+X11 +Minimal +default-Gnome +-Con: + +=Cat: baseconf + +=Vis: true + +=Ord: 04 + ++Prq: +SDL +SDL-32bit +SDL_image +SDL_mixer +SDL_mixer-32bit +SDL_net +SDL_perl +SDL_ttf +-Prq: + ++Prc: +a2ps +aalib +aalib-32bit +alsa-firmware +amarok-xine +atk +atk-32bit +autofs +avm_fcdsl +bluez-libs +bluez-utils +bootsplash +bootsplash-theme-SuSE +cairo +cairo-32bit +capi4linux +capi4linux-32bit +cdrdao +cdrecord +cifs-mount +compat +compat-32bit +compat-curl2 +compat-curl2-32bit +cups +cups-SUSE-ppds-dat +cups-client +cups-drivers +cups-drivers-stp +cups-libs +cups-libs-32bit +dbus-1-qt +dbus-1-qt-32bit +dbus-1-x11 +dcraw +dos2unix +dosbootdisk +dosfstools +enigma +expat +expat-32bit +filters +fontconfig +fontconfig-32bit +foomatic-filters +freeciv +freetype2 +freetype2-32bit +frozen-bubble +gail +gail-32bit +gdb +ghostscript-fonts-other +ghostscript-fonts-std +ghostscript-library +ghostscript-x11 +gl-117 +gle +glib +glib-32bit +glitz +glitz-32bit +gnome-desktop +gnome-desktop-32bit +gnome-filesystem +gnome-icon-theme +gnome-keyring +gnome-keyring-32bit +gpg2 +gtk2 +gtk2-32bit +hplip +hplip-hpijs +i4l-base +i4l-isdnlog +i4lfirm +id3lib +ispell +ispell-american +ispell-british +joe +jpeg +kdebindings3-python +kdelibs3-doc +libao +libbonoboui +libbonoboui-32bit +libcap +libcap-32bit +libcroco +libcroco-32bit +libevent +libgimpprint +libglade2 +libglade2-32bit +libgnomecanvas +libgnomecanvas-32bit +libgnomecups +libgnomecups-32bit +libgnomeprint +libgnomeprint-32bit +libgnomeprintui +libgnomeprintui-32bit +libgnomesu +libgnomeui +libgnomeui-32bit +libgsf +libgsf-32bit +libgssapi +libgtkhtml +libgtkhtml-32bit +libimnxcert +libjpeg +libjpeg-32bit +libkexif +libkipi +liblcms +liblcms-32bit +libmal +libmikmod +libmikmod-32bit +libmng +libmng-32bit +libnetpbm +libnetpbm-32bit +libogg +libogg-32bit +libpcap +libpng +libpng-32bit +librpcsecgss +librsvg +librsvg-32bit +libsamplerate +libtiff +libtiff-32bit +libvisual +libvorbis +libvorbis-32bit +libwmf +linux-atm-lib +linux32 +man-pages +manufacturer-PPDs +mc +microcode_ctl +mtools +net-snmp +nfs-utils +nfsidmap +ntfsprogs +ocrad +openct +openobex +opensc +pango +pango-32bit +perl-DBD-SQLite +perl-DBI +perl-TermReadKey +perl-TimeDate +pico +pin +powerpc32 +ppp +pptp +python +python-32bit +python-xml +qca +qscintilla +samba-client +screen +setserial +shared-mime-info +slang +slang-32bit +smpppd +strace +strace-32bit +subdomain-leaf-cert +sudo +sumf +supertux +tiff +unrar +unzip +update-alternatives +v4l-conf +vacation +wdiff +wget +wireless-tools +words +wvdial +wvstreams +xinetd +xntp +xorg-x11-libs +xorg-x11-libs-32bit +xpdf-config +yast2-printer +yast2-samba-server +yp-tools +ypbind +zip +ziptool +zisofs-tools +zsh +-Prc: + -- 2.7.4