/***********************************************************************1* *2* This software is part of the ast package *3* Copyright (c) 2003-2011 AT&T Intellectual Property *4* and is licensed under the *5* Eclipse Public License, Version 1.0 *6* by AT&T Intellectual Property *7* *8* A copy of the License is available at *9* http://www.eclipse.org/org/documents/epl-v10.html *10* (with md5 checksum b35adb5213ca9657e911e9befb180842) *11* *12* Information and Software Systems Research *13* AT&T Research *14* Florham Park NJ *15* *16* Phong Vo <[email protected]> *17* Glenn Fowler <[email protected]> *18* *19***********************************************************************/20#include "vctest.h"2122int main()23{24char *tar, *del, *t;25Vcodex_t *vc;26ssize_t k, n;2728tar = "00000011111122222abc012000000111111222222012abc";29/* MTF: O0000010000020000abc55520000020000020000022255530ASCII: O 1 2 abc31POS: 0123456789012345678901234567890123456789012345632*/3334if(!(vc = vcopen(0, Vcmtf, "0", 0, VC_ENCODE)) )35terror("Cannot open Vcmtf handle");3637if((n = vcapply(vc, tar, strlen(tar), &del)) <= 0)38terror("Vcmtf0 failed");3940if(!(vc = vcopen(0, Vcmtf, "0", 0, VC_DECODE)) )41terror("Cannot open Vcunmtf0 handle");42if((n = vcapply(vc, del, n, &t)) != strlen(tar) )43terror("Vcunmtf0 returns wrong size");44for(k = 0; k < n; ++k)45if(t[k] != tar[k])46terror("Vcunmtf0 computed bad byte");4748tar = "00000011111122222abc012000000111111222222012abc";49/* MTS: 01000011000021000abc55021000021000021000022055550ASCII: O 1 2 abc51POS: 0123456789012345678901234567890123456789012345652*/5354if(!(vc = vcopen(0, Vcmtf, 0, 0, VC_ENCODE)) )55terror("Cannot open Vcmtf1 handle");5657if((n = vcapply(vc, tar, strlen(tar), &del)) <= 0)58terror("Vcmtf1 failed");5960if(!(vc = vcopen(0, Vcmtf, 0, 0, VC_DECODE)) )61terror("Cannot open Vcunmtf1 handle");62if((n = vcapply(vc, del, n, &t)) != strlen(tar) )63terror("Vcunmtf returns wrong size");64for(k = 0; k < n; ++k)65if(t[k] != tar[k])66terror("Vcunmtf computed bad byte");6768exit(0);69}707172