add the first sukta of Rg Veda to the tests

This commit is contained in:
Vlasta Vesely 2021-02-19 13:27:40 +01:00
parent 4b8b2a633e
commit 4c7bb91e70
5 changed files with 37 additions and 3 deletions

2
iast.c
View file

@ -42,7 +42,7 @@ static struct translit_letter table[] = {
{0x0939, CONSONANT, "h"}, /* 14 */
{0x091a, CONSONANT, "c"}, /* 15 */
{0x091c, CONSONANT, "j"}, /* 16 */
{0x091e, CONSONANT, "\u00f1"}, /* 17 (n~) */
{0x091e, CONSONANT, "\u00f1"}, /* 17 (~n) */
{0x092f, CONSONANT, "y"}, /* 18 */
{0x0936, CONSONANT, "\u015b"}, /* 19 ("s) */
{0x091f, CONSONANT, "\u1e6d"}, /* 20 (.t) */

2
main.c
View file

@ -4,7 +4,7 @@
#include "velthuis.h"
#define PROGNAME "iast"
#define VERSION "1.0"
#define VERSION "2.0"
#define FLAG_REVERSE 1 << 0
#define FLAG_ENCODE 1 << 1

View file

@ -5,12 +5,14 @@ usage=$(./iast -h)
test -n $(echo "$usage" | grep "iast [flags and text arguments in any order]")
version=$(./iast -v)
test "$version" = "iast v1.0"
test "$version" = "iast v2.0"
./iast -f tests/texts/bhagavadgita-1.txt |
./iast -r -f - >/tmp/iast-bhagavadgita-1.txt.out
./iast -f tests/texts/mandukya-upanishad.txt |
./iast -r -f - >/tmp/iast-mandukya-upanishad.txt.out
./iast -f tests/texts/rg-01001.txt |
./iast -r -f - >/tmp/rg-01001.txt.out
expected=$(sha1sum tests/texts/bhagavadgita-1.txt | head -c40)
computed=$(sha1sum /tmp/iast-bhagavadgita-1.txt.out | head -c40)
@ -20,4 +22,8 @@ expected=$(sha1sum tests/texts/mandukya-upanishad.txt | head -c40)
computed=$(sha1sum /tmp/iast-mandukya-upanishad.txt.out | head -c40)
test "$expected" = "$computed"
expected=$(sha1sum tests/texts/rg-01001.txt | head -c40)
computed=$(sha1sum /tmp/rg-01001.txt.out | head -c40)
test "$expected" = "$computed"
printf "\033[32mpassed\033[0m\n"

26
tests/texts/rg-01001.txt Normal file
View file

@ -0,0 +1,26 @@
ॐ अग्निमी॑ळे पुरोहि॑तं यज्ञस्य॓ देवमृत्विज॑म् ।
होता॑रं रत्नधात॑मम् ॥१॥
अग्निः पूर्वेभिरृषिभिरीड्यो नूतनैरुत ।
स देवाँ एह वक्षति ॥२॥
अग्निना रयिमश्नवत् पोषमेव दिवेदिवे ।
यशसं वीरवत्तमम् ॥३॥
अग्ने यं यज्ञमध्वरं विश्वतः परिभूरसि ।
स इद्देवेषु गच्छति ॥४॥
अग्निर्होता कविक्रतुः सत्यश्चित्रश्रवस्तमः ।
देवो देवेभिरा गमत् ॥५॥
यदङ्ग दाशुषे त्वमग्ने भद्रं करिष्यसि ।
तवेत् तत् सत्यमङ्गिरः ॥६॥
उप त्वाग्ने दिवेदिवे दोषावस्तर्धिया वयम् ।
नमो भरन्त एमसि ॥७॥
राजन्तमध्वराणां गोपामृतस्य दीदिविम् ।
वर्धमानं स्वे दमे ॥८॥
स नः पितेव सूनवेऽग्ने सूपायनो भव ।
सचस्वा नः स्वस्तये ॥९॥

View file

@ -113,6 +113,7 @@ char *transliterate_latin_to_devanagari(const char *latin)
alloc += CHUNKSIZE;
}
/* consonant (.l) */
if (strncmp(src, "\u1e37", 3) == 0) {
letter = letter_by_data(table, src + 3);
if (letter && letter->type == VOWEL) {
@ -123,6 +124,7 @@ char *transliterate_latin_to_devanagari(const char *latin)
}
}
/* candrabindu */
if (strncmp(src, "m\u0310", 3) == 0) {
utf8_pack_char(devanagari + done, 0x0901);
done += 3;