How can I use Perl to test C programs?

I am looking for several tutorials showing how I can test C programs by writing Perl programs to automate testing.

Mostly I want to learn automation testing using Perl programs. Can you kindly share such tutorials or experiences that can help me start this process?

+3
source share
5 answers

Perl tests typically use TAP . There are several C libraries for TAP . Check out the Perl presentation .

+10
source

Perl Testing: .

, perlmongers. , , , .


UPDATE:

Hm, , - C Perl, Perl- Perl.

- ( , , , Test::More ), Perl C, .

sub run_my_c_program {
    my @args=@_;

    #Set up test environment according to @args

    system "my-c-program";

    # Turns restults into a $rv data structure

    return $rv;
}

$rv , Perl:

is_deeply(run_my_c_program(...),
          { .. what I think it returns ..}, 
          ".. description of what I'm testing ..");
+2

, Perl , Perl Perl. Test:: More - . , Test:: * CPAN, , , .

, . , .

+2

, , ++. ( ), , Perl, . Perl , , ( " " . : $compilerOutput = `cl -?`; ), , , , .

, Perl:

  • / Perl .
  • () . Perl C, perl , C ( , ).
  • , , .

-Ron

+1

C Libtap, Perl Test:: Harness C. : https://github.com/stig/libggtl/tree/master/t - , , , , , : -)

0
source

Source: https://habr.com/ru/post/1717548/


All Articles