Sorry I didn't express my problem correctly. My problem is generate a set of test cases automatically in Ruby, and use it to test the c program get the statement coverage which should be pass to ruby, the ruby program supposed to use a search method to generate the better test cases to test the c program again untill find the best test cases which can fullly cover all of the statements.. That means the input of c program should be generated from ruby and the result of statement coverage should be passed to ruby. Maggie ----- Original Message ----- From: "Phil Tomson" <ptkwt / shell1.aracnet.com> Newsgroups: comp.lang.ruby To: "ruby-talk ML" <ruby-talk / ruby-lang.org> Sent: Thursday, September 19, 2002 6:19 PM Subject: Re: generate the test data in Ruby for a c program > In article <000801c26032$47a23800$1800000a / ee.ualberta.ca>, > Maggie Xiao <mxiao / ee.ualberta.ca> wrote: > >Hi there, > > > >I'd like to generate the test data in Ruby for a c program and test it. Has > >anyone tried to do it? Can you give me some ideas? What do you think is the > >best way to do it ?Any reply will be highly appreciated. > > > > Could you give some more details? > > One guess would be that this is a standalone C program that takes some > input on the command line, like: > > > foo -name Fred -title Coder > > and then does something meaningful with the input. > > You could, in Ruby generate command lines like: > > results = `foo -name #{name} -title #{occupation}` > > Then you could check the results string... > > However, without more details it's kind'a hard to say. > > If you actually want to access your C code from within Ruby and then do > all of your testing inside of Ruby you could use swig > (http://www.swig.org)....Why do I feel like that duck in the AFLAC > commercial? Instead of 'AFLAC' I say 'Swig'. > > Phil >