diff options
Diffstat (limited to 'tests/charset')
-rw-r--r-- | tests/charset/main.cpp | 40 | ||||
-rwxr-xr-x | tests/charset/run-test.sh | 47 | ||||
-rw-r--r-- | tests/charset/test-suites/gnu.in.utf-8 | 48 | ||||
-rw-r--r-- | tests/charset/test-suites/gnu.out.iso-8859-1 | 48 |
4 files changed, 183 insertions, 0 deletions
diff --git a/tests/charset/main.cpp b/tests/charset/main.cpp new file mode 100644 index 00000000..5bf3a647 --- /dev/null +++ b/tests/charset/main.cpp @@ -0,0 +1,40 @@ +// +// VMime library (http://vmime.sourceforge.net) +// Copyright (C) 2002-2004 Vincent Richard <[email protected]> +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of +// the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +// + +#include <iostream> +#include <ostream> + +#include "../../src/vmime" +#include "../../examples/common.inc" + + +int main(int argc, char* argv[]) +{ + // VMime initialization + vmime::platformDependant::setHandler<my_handler>(); + + + const vmime::string from(argv[1]); + const vmime::string to(argv[2]); + + vmime::inputStreamAdapter in(std::cin); + vmime::outputStreamAdapter out(std::cout); + + vmime::charset::convert(in, out, from, to); +} diff --git a/tests/charset/run-test.sh b/tests/charset/run-test.sh new file mode 100755 index 00000000..d7ad5295 --- /dev/null +++ b/tests/charset/run-test.sh @@ -0,0 +1,47 @@ +#!/bin/sh + +TEST_DIR="./test-suites" +TEMP_DIR="/tmp" +PROGRAM="./main" + + +testFiles=`cd $TEST_DIR ; find . -regex '\./[^\.]*\.in\..*' -maxdepth 1 -type f` + +echo +echo Testing charset conversions +echo ===================================================================== + +for testFile in $testFiles ; do + + testName=`echo $testFile | sed 's/^\.\/\([^\.]*\).*/\1/'` + sourceCharset=`echo $testFile | sed 's/^\.\/[^\.]*\.[^\.]*\.\(.*\)/\1/'` + + testOutFiles=`cd $TEST_DIR ; find . -regex "\./$testName\.out\..*" -maxdepth 1 -type f` + + for testOutFile in $testOutFiles ; do + + destCharset=`echo $testOutFile | sed 's/^\.\/[^\.]*\.[^\.]*\.\(.*\)/\1/'` + + printf %20s "$testName " + printf %30s "$sourceCharset --> $destCharset : " + + $PROGRAM $sourceCharset $destCharset < $TEST_DIR/$testFile > $TEMP_DIR/vmime_result + + diff="diff $TEMP_DIR/vmime_result $TEST_DIR/$testOutFile" + res=`$diff` + + if [ "$res" = "" ] + then + echo "[OK]" + else + diffFile=$TEMP_DIR/vmime.charset.$testName.$sourceCharset.$destCharset.diff + echo "[NO: diff file is $diffFile]" + $diff > $diffFile + fi + + done + +done + +echo + diff --git a/tests/charset/test-suites/gnu.in.utf-8 b/tests/charset/test-suites/gnu.in.utf-8 new file mode 100644 index 00000000..782bb84e --- /dev/null +++ b/tests/charset/test-suites/gnu.in.utf-8 @@ -0,0 +1,48 @@ +Korean Part. +GNU 프로젝트의 웹서버인 www.gnu.org에 오신 것을 환영합니다. GNU 프로젝트는 +GNU 시스템이라고 불리는 유닉스 형태의 완벽한 자유 소프트웨어 운영체제를 +개발하기 위해서 1984년부터 시작되었습니다. (GNU라는 단어는 ``GNU's Not +Unix''를 의미하는 재귀적 약어이며 ``그-뉴"라고 발음합니다.) GNU +시스템으로부터 연유한 다양한 종류의 운영체제들이 현재 ``리눅스''라는 +이름으로 사용되고 있지만, 시스템 커널로 리눅스를 탑재한 운영체제의 보다 +정확한 이름은 GNU/리눅스 시스템입니다. + +Japanese Part + +GNU プロジェクトのウェブサーバ、www.gnu.org へようこそ。1984 年のプロジェクト +開始以来、GNU プロジェクトでは、Unix に似た フリーソフトウェアの完全なオペレー +ティングシステム、GNU システムを開発して来ました(GNU とは「GNU's Not Unix(GNU +は Unix ではない)」の再帰頭字語であり、「グニュー」と発音されます)。現在、カーネ +ルとして Linux を用いた GNU システムのさまざまな変種が広く使われています。これ +らのシステムは「Linux」と呼ばれることが多いのですが、より正確には GNU/Linux +システム と呼ばれるものなのです。 + +Chinese Part. + +歡迎來到GNU 專案的伺服主機,www.gnu.org。 GNU 專案 開始於1984年,旨在發展一 +個 Unix-like 且為 自由軟體 的作業系統: GNU 系統。(GNU 是由``GNU's Not +Unix''所遞迴定義出的頭字語);它的發音為"guh-NEW"。各種使用 Linux 作為核心的 GNU +作業系統正被廣泛的使用著;雖然這些系統通常被稱作 ``Linux'',但是它們應該更精 +確地被稱為 GNU/Linux 系統。 + +English Part. + +Welcome to the GNU Project web server, www.gnu.org. The GNU Project was +launched in 1984 to develop a complete Unix-like operating system which is +free software: the GNU system. (GNU is a recursive acronym for ``GNU's Not +Unix''; it is pronounced "guh-NEW".) Variants of the GNU operating system, +which use the kernel Linux, are now widely used; though these systems are +often referred to as ``Linux'', they are more accurately called GNU/Linux +systems. + +French Part. +Bienvenue sur le serveur web du projet GNU, www.gnu.org. Le projet GNU a été +lancé en 1984 afin de développer un système d'exploitation complet, +semblable à Unix et qui soit un logiciel libre: le système GNU. (« GNU » +est l'acronyme récursif the « GNU's Not Unix »; on le prononce « gnou » +avec un G audible) Des variantes du système d'exploitation GNU, basées sur +le noyau « Linux », sont utilisées largement à présent; bien que ces +systèmes soient communément appelés par le terme « Linux », ils le +seraient plus exactement par « GNU/Linux ». + + diff --git a/tests/charset/test-suites/gnu.out.iso-8859-1 b/tests/charset/test-suites/gnu.out.iso-8859-1 new file mode 100644 index 00000000..bc11399e --- /dev/null +++ b/tests/charset/test-suites/gnu.out.iso-8859-1 @@ -0,0 +1,48 @@ +Korean Part. +GNU ??????????????? ???????????? www.gnu.org??? ?????? ?????? ???????????????. GNU ??????????????? +GNU ?????????????????? ????????? ????????? ????????? ????????? ?????? ??????????????? ??????????????? +???????????? ????????? 1984????????? ?????????????????????. (GNU?????? ????????? ``GNU's Not +Unix''??? ???????????? ????????? ???????????? ``???-???"?????? ???????????????.) GNU +????????????????????? ????????? ????????? ????????? ?????????????????? ?????? ``?????????''?????? +???????????? ???????????? ?????????, ????????? ????????? ???????????? ????????? ??????????????? ?????? +????????? ????????? GNU/????????? ??????????????????. + +Japanese Part + +GNU ??????????????????????????????????????????www.gnu.org ??????????????????1984 ???????????????????????? +???????????????GNU ???????????????????????????Unix ????????? ??????????????????????????????????????????????????? +???????????????????????????GNU ???????????????????????????????????????(GNU ?????????GNU's Not Unix(GNU +??? Unix ????????????)????????????????????????????????????????????????????????????????????????)????????????????????? +???????????? Linux ???????????? GNU ??????????????????????????????????????????????????????????????????????????? +????????????????????????Linux?????????????????????????????????????????????????????????????????? GNU/Linux +???????????? ???????????????????????????????????? + +Chinese Part. + +????????????GNU ????????????????????????www.gnu.org??? GNU ?????? ?????????1984????????????????????? +??? Unix-like ?????? ???????????? ?????????????????? GNU ????????????GNU ??????``GNU's Not +Unix''???????????????????????????????????????????????????"guh-NEW"??????????????? Linux ??????????????? GNU +???????????????????????????????????????????????????????????????????????? ``Linux''??????????????????????????? +??????????????? GNU/Linux ????????? + +English Part. + +Welcome to the GNU Project web server, www.gnu.org. The GNU Project was +launched in 1984 to develop a complete Unix-like operating system which is +free software: the GNU system. (GNU is a recursive acronym for ``GNU's Not +Unix''; it is pronounced "guh-NEW".) Variants of the GNU operating system, +which use the kernel Linux, are now widely used; though these systems are +often referred to as ``Linux'', they are more accurately called GNU/Linux +systems. + +French Part. +Bienvenue sur le serveur web du projet GNU, www.gnu.org. Le projet GNU a �t� +lanc� en 1984 afin de d�velopper un syst�me d'exploitation complet, +semblable � Unix et qui soit un logiciel libre: le syst�me GNU. (� GNU � +est l'acronyme r�cursif the � GNU's Not Unix �; on le prononce � gnou � +avec un G audible) Des variantes du syst�me d'exploitation GNU, bas�es sur +le noyau � Linux �, sont utilis�es largement � pr�sent; bien que ces +syst�mes soient commun�ment appel�s par le terme � Linux �, ils le +seraient plus exactement par � GNU/Linux �. + + |