From: Kouhei S. <ko...@cl...> - 2013-12-06 03:29:09
|
Hi, In <CAHR5+EF3xzHCO2vtS7VmnwfWABmh=-tx...@ma...> "[cutter-users-en] Is there a way to loop over tests with different settings?" on Wed, 4 Dec 2013 15:42:31 -0500, Chris Bare <chr...@gm...> wrote: > I am writing test cases for a serial protocol library. I would like to be > able to run all the tests at various different baud rates. My only idea so > far is to create a .c file for each baud rate and #include the actual test > implementation in each file. Is there a better way? How about the following idea? = Pass baud rate by environment variable and run Cutter N times Create the following shell script run-test.sh: -- #!/bin/sh set -e baud_rates="1024 2048 4096" for baud_rate in ${baud_rates}; do BAUD_RATE=${baud_rate} cutter ... done -- *.c: -- #include <stdlib.h> static int baud_rate; void cut_setup(void) { baud_rate = atoi(getenv("BAUD_RATE")); } void test_XXX(void) { assert_equal(YYY, your_function(baud_rate)); } -- Thanks, -- kou |