<commit_before>(:
 : Copyright 2006-2011 The FLWOR Foundation.
 :
 : Licensed under the Apache License, Version 2.0 (the "License");
 : you may not use this file except in compliance with the License.
 : You may obtain a copy of the License at
 :
 : http://www.apache.org/licenses/LICENSE-2.0
 :
 : Unless required by applicable law or agreed to in writing, software
 : distributed under the License is distributed on an "AS IS" BASIS,
 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 : See the License for the specific language governing permissions and
 : limitations under the License.
 :)

(:~
 : Zorba FOTS driver CLI
 : @author <NAME>, <NAME>
 :)

import module namespace d =
  "http://www.zorba-xquery.com/fots-driver" at "fots-driver.xq";
import module namespace r =
  "http://www.zorba-xquery.com/fots-driver/reporting" at "reporting.xq";

(:~ path to the place where FOTS can be found :)
declare variable $fotsPath as xs:string external := "";

(:~ path to the place where the FOTS Zorba manifest can be found :)
declare variable $fotsZorbaManifestPath as xs:string external :=
  "FOTSZorbaManifest.xml";

(:~ Path to the results from a previous run :)
declare variable $failuresFilePath as xs:string external := "";

(:~ choose the CLI option you want to run :)
declare variable $mode as xs:string external := "";

(:~ name/criteria for the test sets :)
declare variable $testSetPrefixes as xs:string external := "";

(:~ name/criteria for the test cases :)
declare variable $testCasePrefixes as xs:string external := "";

(:~ name for the test set :)
declare variable $testSetName as xs:string external := "";

(:~ name for the test case :)
declare variable $testCaseName as xs:string external := "";

(:~ Enable or disable verbose output :)
declare variable $verbose as xs:string external := "false";

(:~ assertion type :)
declare variable $assertType as xs:string external := "";

(:~ dependency: used in 'list-test-cases' and 'run-test-sets' modes:)
declare variable $dependency as xs:string external := "";

(:~ regex for the tests in the 'list-matching-test-cases' option :)
declare variable $pattern as xs:string external := "";

(:~ flags for the tests in the 'list-matching-test-cases' option :)
declare variable $flags as xs:string external := "";

(:~ Path to the ExpectedFailures file :)
declare variable $expectedFailuresPath  as xs:string external :="";

(:~ Tokenize comma or empty string :)
declare %private function local:tokenize(
  $input as xs:string
) as xs:string*
{
  let $tokens := tokenize($input, ",")
  return if (exists($tokens)) then $tokens else ""
};

declare function local:usage() as xs:string
{
  string-join((
    "Zorba FOTS driver usage examples:",
    "If you run Zorba from a checkout of the trunk and the build/bin folder,",
    "- /path/to/cli.xq can be set to ../../test/fots_driver/cli.xq",
    "",
    "Always try to output the result back to an XML file with nice indentation:",
    "./zorba -f -q ../../test/fots_driver/cli.xq -e SET_CLI_OPTIONS_HERE -o output.xml --indent",
    "",
    " This way you will see trace information in the CLI window and detailed",
    " results of the test cases in the 'output.xml'.",
    "",
    "zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e fotsZorbaManifestPath:=/path/to/Zorba_manifest.xml -e mode:=list-test-sets",
    "zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-test-sets",<commit_msg>Added info about the change.<commit_after>(:
 : Copyright 2006-2011 The FLWOR Foundation.
 :
 : Licensed under the Apache License, Version 2.0 (the "License");
 : you may not use this file except in compliance with the License.
 : You may obtain a copy of the License at
 :
 : http://www.apache.org/licenses/LICENSE-2.0
 :
 : Unless required by applicable law or agreed to in writing, software
 : distributed under the License is distributed on an "AS IS" BASIS,
 : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 : See the License for the specific language governing permissions and
 : limitations under the License.
 :)

(:~
 : Zorba FOTS driver CLI
 : @author <NAME>, <NAME>
 :)

import module namespace d =
  "http://www.zorba-xquery.com/fots-driver" at "fots-driver.xq";
import module namespace r =
  "http://www.zorba-xquery.com/fots-driver/reporting" at "reporting.xq";

(:~ path to the place where FOTS can be found :)
declare variable $fotsPath as xs:string external := "";

(:~ path to the place where the FOTS Zorba manifest can be found :)
declare variable $fotsZorbaManifestPath as xs:string external :=
  "FOTSZorbaManifest.xml";

(:~ Path to the results from a previous run :)
declare variable $failuresFilePath as xs:string external := "";

(:~ choose the CLI option you want to run :)
declare variable $mode as xs:string external := "";

(:~ name/criteria for the test sets :)
declare variable $testSetPrefixes as xs:string external := "";

(:~ name/criteria for the test cases :)
declare variable $testCasePrefixes as xs:string external := "";

(:~ name for the test set :)
declare variable $testSetName as xs:string external := "";

(:~ name for the test case :)
declare variable $testCaseName as xs:string external := "";

(:~ Enable or disable verbose output. When this is set to true the exact query
    that is run by XQXQ is also written down into a query_*.xq file :)
declare variable $verbose as xs:string external := "false";

(:~ assertion type :)
declare variable $assertType as xs:string external := "";

(:~ dependency: used in 'list-test-cases' and 'run-test-sets' modes:)
declare variable $dependency as xs:string external := "";

(:~ regex for the tests in the 'list-matching-test-cases' option :)
declare variable $pattern as xs:string external := "";

(:~ flags for the tests in the 'list-matching-test-cases' option :)
declare variable $flags as xs:string external := "";

(:~ Path to the ExpectedFailures file :)
declare variable $expectedFailuresPath  as xs:string external :="";

(:~ Tokenize comma or empty string :)
declare %private function local:tokenize(
  $input as xs:string
) as xs:string*
{
  let $tokens := tokenize($input, ",")
  return if (exists($tokens)) then $tokens else ""
};

declare function local:usage() as xs:string
{
  string-join((
    "Zorba FOTS driver usage examples:",
    "If you run Zorba from a checkout of the trunk and the build/bin folder,",
    "- /path/to/cli.xq can be set to ../../test/fots_driver/cli.xq",
    "",
    "Always try to output the result back to an XML file with nice indentation:",
    "./zorba -f -q ../../test/fots_driver/cli.xq -e SET_CLI_OPTIONS_HERE -o output.xml --indent",
    "",
    " This way you will see trace information in the CLI window and detailed",
    " results of the test cases in the 'output.xml'.",
    "",
    " Please note that when Verbose is set to true the query that is executed",
    " is written down into a query_TESTCASENAME.xq file, where TESTCASENAME is",
    " the test case name.",
    "",
    "zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e fotsZorbaManifestPath:=/path/to/Zorba_manifest.xml -e mode:=list-test-sets",
    "zorba -f -q /path/to/cli.xq -e fotsPath:=/path/to/QT3-test-suite/catalog.xml -e mode:=list-test-sets",
{'fraction_non_alphanumeric': 0.12520525451559936, 'fraction_numerical': 0.0038314176245210726, 'mean_word_length': 3.9053691275167783, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 12}, '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': '3590970', 'n_tokens_mistral': 2312, 'n_tokens_neox': 2190, 'n_words': 851}