<commit_before>#!/usr/bin/perl -w

# Note: this must be run from the root directory of the pod

$CMAKE_INSTALL_PREFIX = `cmake pod-build -L | grep CMAKE_INSTALL_PREFIX | cut -d "=" -f2 | tr -d '[:space:]'`;
$CMAKE_SOURCE_DIR = `pwd | tr -d '[:space:]'`;
$POD_NAME = `cmake pod-build -L | grep POD_NAME | cut -d "=" -f2 | tr -d '[:space:]'`;

# write unit tests to .matlab_ctests
system("matlab -nodisplay -r \"addpath('$CMAKE_INSTALL_PREFIX/matlab'); addpath_$POD_NAME; options.gui = false; options.autorun = false; options.test_list_file = 'pod-build/matlab_ctests'; unitTest(options); exit;\"");

open(my $in, 'pod-build/matlab_ctests');
open(my $ctestfile, '>>', 'pod-build/CTestTestfile.cmake');

while (<$in>) {
  ($test,$testdir) = split(' ');
  $testname = $testdir."/".$test;
  $testname =~ s/\Q$CMAKE_SOURCE_DIR\///;

#  $failcondition = "1";   # missing dependency => failure
  $failcondition = "~strncmp(ex.identifier,'Drake:MissingDependency',23)";  # missing dependency => pass

  print $ctestfile "ADD_TEST($testname \"matlab\" \"-nosplash\" \"-nodisplay\" \"-r\" \"addpath('$CMAKE_INSTALL_PREFIX/matlab'); addpath_$POD_NAME; rng('shuffle'); rng_state=rng; try, feval('$test'); catch ex, disp(getReport(ex,'extended')); fprintf(1,'To reproduce this test use \\\"rng(%d,''%s'')\\\"\n',rng_state.Seed,rng_state.Type); force_close_system; exit($failcondition); end; force_close_system; exit(0)\")\n";
  print $ctestfile "SET_TESTS_PROPERTIES($testname PROPERTIES  WORKING_DIRECTORY \"$testdir\")\n";
}
<commit_msg>fix perl syntax for rng info printing<commit_after>#!/usr/bin/perl -w

# Note: this must be run from the root directory of the pod

$CMAKE_INSTALL_PREFIX = `cmake pod-build -L | grep CMAKE_INSTALL_PREFIX | cut -d "=" -f2 | tr -d '[:space:]'`;
$CMAKE_SOURCE_DIR = `pwd | tr -d '[:space:]'`;
$POD_NAME = `cmake pod-build -L | grep POD_NAME | cut -d "=" -f2 | tr -d '[:space:]'`;

# write unit tests to .matlab_ctests
system("matlab -nodisplay -r \"addpath('$CMAKE_INSTALL_PREFIX/matlab'); addpath_$POD_NAME; options.gui = false; options.autorun = false; options.test_list_file = 'pod-build/matlab_ctests'; unitTest(options); exit;\"");

open(my $in, 'pod-build/matlab_ctests');
open(my $ctestfile, '>>', 'pod-build/CTestTestfile.cmake');

while (<$in>) {
  ($test,$testdir) = split(' ');
  $testname = $testdir."/".$test;
  $testname =~ s/\Q$CMAKE_SOURCE_DIR\///;

#  $failcondition = "1";   # missing dependency => failure
  $failcondition = "~strncmp(ex.identifier,'Drake:MissingDependency',23)";  # missing dependency => pass

  print $ctestfile "ADD_TEST($testname \"matlab\" \"-nosplash\" \"-nodisplay\" \"-r\" \"addpath('$CMAKE_INSTALL_PREFIX/matlab'); addpath_$POD_NAME; rng('shuffle'); rng_state=rng; try, feval('$test'); catch ex, disp(getReport(ex,'extended')); disp(sprintf('To reproduce this test use \\\"rng(%d,''%s'')\\\"',rng_state.Seed,rng_state.Type)); force_close_system; exit($failcondition); end; force_close_system; exit(0)\")\n";
  print $ctestfile "SET_TESTS_PROPERTIES($testname PROPERTIES  WORKING_DIRECTORY \"$testdir\")\n";
}

{'fraction_non_alphanumeric': 0.20091027308192458, 'fraction_numerical': 0.0042262678803641094, 'mean_word_length': 5.305327868852459, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5370709', 'n_tokens_mistral': 1213, 'n_tokens_neox': 1162, 'n_words': 242}