From 88283b9eea5c02337fd02a0ad82ca0a064be7aae Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Mon, 3 Jul 2023 17:46:23 -0700 Subject: [PATCH] add -s option to convergence test utility --- dev-bin/run_convergence_tests.pl | 52 ++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 2 deletions(-) diff --git a/dev-bin/run_convergence_tests.pl b/dev-bin/run_convergence_tests.pl index 88224335..ed1d5f09 100755 --- a/dev-bin/run_convergence_tests.pl +++ b/dev-bin/run_convergence_tests.pl @@ -16,7 +16,7 @@ There are four options: run [DEFAULT], pack, merge, unpack ( -r -p -m -u ) usage: - $0 -h -u -m -p -r [ arg1 arg2 ... + $0 -h -u -m -p -r -s [ arg1 arg2 ... where one parameter may be given to specify the operation to be done: @@ -26,6 +26,7 @@ where one parameter may be given to specify the operation to be done: -m merge files given in arg list into the default or specified database -p packs files given in arg list into a new database -e overwrites old expect data with the new results for cases run + -s write statistics on parameter frequency to stdout and exit -r runs the tests [DEFAULT operation] arg1 arg2 ... may contain: @@ -88,6 +89,7 @@ my @option_string = qw( m p r + s u ); @@ -114,10 +116,12 @@ if ( -e $tmp_dir && !-d $tmp_dir ) { exit 1; } -print <{$fname}; + my @lines = split /^/, $string; + foreach my $line (@lines) { + $line =~ s/^\s+//; + $line =~ s/\s+$//; + if ( $line && $line =~ /^-/ ) { + if ( $line =~ /^-+(\w[\w-]*)/ ) { + $rcount->{$1}++; + } + } + } + } + } + + # For a spreadsheet: +## my @sorted_keys = sort { $rcount->{$b} <=> $rcount->{$a} } keys %{$rcount}; +## foreach my $key (@sorted_keys) { +## print "$rcount->{$key}, $key\n"; +## } + + # For a script: + use Data::Dumper; + print Dumper($rcount); + + return; +} + sub pack_data { my ( $db_fname, $rfiles ) = @_; my $rdata = read_files_to_hash($rfiles); -- 2.39.5