+++ /dev/null
-
-On a directed acyclic graph, is it
\ No newline at end of file
+++ /dev/null
-# Suffix Conventions
-
-## Specify interface used with variable when clarification is useful:
-
-- `_set`: Indicates that the variable holds a set of items.
-
-- `_list`: Used for variables that represent a list of items.
-
-- `_f`: Refers to a function.
-
-Instead of making a variable name plural, add the interface qualifier:
-
- e.g. names -> name_set or name_list
-
-## Always a good idea to use these when working with files:
-
-- `_fp`: Refers to a file path. The part after the last slash is a file name.
-
-- `_dp`: Refers to a directory path. By convention, the value ends in a slash.
-
-- `_fn`: Refers to a file name. Value has no slashes.
-
-- `_dn`: Refers to a directory name. Value has no slashes.
-
-- `_fn_base`: The file name without the last dot and subsequent characters.
-
-- `_fn_ext`: The subsequent characters after the last dot in a file name.
--- /dev/null
+#!/bin/bash
+java com.ReasoningTechnology."Mosaic".Mosaic
+++ /dev/null
-#!/bin/bash
-java com/ReasoningTechnology/"Mosaic"/build
--- /dev/null
+#!/usr/bin/env bash
+
+# input guards
+
+ if [ -z "$REPO_HOME" ]; then
+ echo "$(script_fp):: REPO_HOME is not set."
+ exit 1
+ fi
+
+ env_must_be="developer/tool/env"
+ if [ "$ENV" != "$env_must_be" ]; then
+ echo "$(script_fp):: error: must be run in the $env_must_be environment"
+ exit 1
+ fi
+
+# script local environment
+
+ release_dir="$REPO_HOME/release"
+ shell_dir="$REPO_HOME/developer/shell"
+ project_jar_fp="$REPO_HOME/developer/jvm/"$PROJECT".jar"
+ wrapper=$(shell_wrapper_list)
+
+
+ if [ ! -d "$release_dir" ]; then
+ mkdir -p "$release_dir"
+ fi
+
+ # Function to copy and set permissions
+ install_file() {
+ source_fp="$1"
+ target_dp="$2"
+ perms="$3"
+
+ target_file="$target_dp/$(basename "$source_fp")"
+
+ if [ ! -f "$source_fp" ]; then
+ echo "install_file:: Source file '$source_fp' does not exist."
+ return 1
+ fi
+
+ if ! install -m "$perms" "$source_fp" "$target_file"; then
+ echo "Error: Failed to install $(basename "$source_fp") to $target_dp"
+ exit 1
+ else
+ echo "Installed $(basename "$source_fp") to $target_dp with permissions $perms"
+ fi
+ }
+
+# do the release
+
+ echo "Starting release process..."
+
+ # Install the JAR file
+ install_file "$project_jar_fp" "$release_dir" "ug+r"
+
+ # Install shell wrappers
+ for wrapper in $wrapper; do
+ install_file "$shell_dir/$wrapper" "$release_dir" "ug+r+x"
+ done
+
+echo "$(script_fp) done."
-#!/bin/bash
+#!/usr/bin/env bash
# Removes all files found in the build directories. It asks no questions as to
# how or why the files got there. Be especially careful with the 'shell' directory
-#!/bin/bash
+#!/usr/bin/env bash
# remove all files created by make's call to `javac`
# input guards
+++ /dev/null
-#!/bin/bash
-# remove all files made by `make`
-
-# input guards
-
- env_must_be="developer/tool/env"
- if [ "$ENV" != "$env_must_be" ]; then
- echo "$(script_fp):: error: must be run in the $env_must_be environment"
- exit 1
- fi
-
-# wrappers to clean (this list space separated list will grow)
-
- wrapper=build
-
-# remove files
-
- set -x
- cd "$REPO_HOME"/developer
- rm -r scratch_pad/com/ReasoningTechnology/"$PROJECT"
- rm jvm/"$PROJECT".jar
- rm shell/{$wrapper}
- set +x
-
-echo "$(script_fn) done."
--- /dev/null
+#!/usr/bin/env bash
+# remove all files made by `make`
+
+# input guards
+
+ env_must_be="developer/tool/env"
+ if [ "$ENV" != "$env_must_be" ]; then
+ echo "$(script_fp):: error: must be run in the $env_must_be environment"
+ exit 1
+ fi
+
+# wrappers to clean (this list space separated list will grow)
+
+ wrapper=$(shell_wrapper_list)
+
+# remove files
+
+ set -x
+ cd "$REPO_HOME"/developer
+ rm -r scratch_pad/com/ReasoningTechnology/"$PROJECT"
+ rm jvm/"$PROJECT".jar
+ rm shell/{$wrapper}
+ set +x
+
+echo "$(script_fn) done."
-#!/bin/bash
+#!/usr/bin/env bash
# remove files made by `make` and by `release`
# input guards
# things to clean
release_dir="$REPO_HOME"/release
- wrapper=build
+ wrapper=$(shell_wrapper_list)
# remove files
set -x
echo "Creating shell wrappers..."
mkdir -p shell
# wrapper is a space separated list
- wrapper=Mosaic
+ wrapper=$(shell_wrapper_list)
for file in $wrapper;do
cat > shell/$file << EOL
#!/bin/bash
release_dir="$REPO_HOME/release"
shell_dir="$REPO_HOME/developer/shell"
project_jar_fp="$REPO_HOME/developer/jvm/"$PROJECT".jar"
- wrapper=build
+ wrapper=$(shell_wrapper_list)
if [ ! -d "$release_dir" ]; then
--- /dev/null
+#!/bin/env bash
+
+# input guards
+
+ env_must_be="developer/tool/env"
+ if [ "$ENV" != "$env_must_be" ]; then
+ echo "$(script_fp):: error: must be run in the $env_must_be environment"
+ exit 1
+ fi
+
+ cd "$REPO_HOME"/developer
+
+# list of classes that have main calls and get shell wrappers
+echo Mosaic
A tool to assist in hierarchical white box testing.
-Each piece of a program must have integrity for the complete picture to merge.
+Each piece of a program must have integrity for the complete picture to emerge.
With Mosaic we test the pieces, then the communication between the pieces.
+Updates for Ariadne
+
1. reflect project skeleton changes.
replaced literal `Ariadne` with `$PROJECT`
in top level env choices, PROJECT -> PROMPT_DECOR
note in 'release' there is a variable name with the project name embedded in it:
Ariadne_jar_fp -> project_jar_fp
Change slashes to dots in the wrapper maker of 'make'
+
+2. should do something about `wrapper` as it appears in multiple places making
+ editing it a pain.
+ in all places `wrapper` appears, now calls `shell_wrapper_list`
+ in both developer and tester
+
+3. clean_make -> clean_make_output
+
+4. version outputs a `v` in front of the number
+
+5. fix many shebangs to be: #!/usr/bin/env bash
+
--- /dev/null
+#!/bin/bash
+java com.ReasoningTechnology."Mosaic".Mosaic
+++ /dev/null
-#!/bin/bash
-java com/ReasoningTechnology/"Mosaic"/build
--- /dev/null
+package com.ReasoningTechnology.Mosaic.Test;
+import com.ReasoningTechnology.Mosaic.Util;
+
+/*
+Test Zero
+
+Plug it in, see if there is smoke. There usually is.
+
+*/
+
+public class Test0{
+
+ public static boolean test_is_true(){
+ return true;
+ }
+
+ public static int run(){
+ boolean[] condition = new boolean[1];
+ condition[0] = test_is_true();
+
+ int i = 0;
+ if( !Util.all(condition) ){
+ System.out.println("Test0 failed");
+ return 1;
+ }
+ System.out.println("Test0 passed");
+ return 0;
+ }
+
+ // Main function to provide a shell interface for running tests
+ public static void main(String[] args){
+ int return_code = run();
+ System.exit(return_code);
+ return;
+ }
+
+}
package com.ReasoningTechnology.Mosaic.Test;
+import com.ReasoningTechnology.Mosaic.IO;
import com.ReasoningTechnology.Mosaic.Util;
-/*
-Testing the IO class.
+public class TestIO{
-*/
+ public static int fut(){
+ try{
+ // Echo some characters from stdin to stdout
+ System.out.print((char) System.in.read());
+ System.out.print((char) System.in.read());
+ // Echo some more characters from stdin to stderr
+ System.err.print((char) System.in.read());
+ System.err.print((char) System.in.read());
-public class TestIO{
+ // Count remaining characters until EOF
+ int count = 0;
+ while( System.in.read() != -1 ){
+ count++;
+ }
- public static boolean test_is_true(){
- return true;
+ return count;
+ } catch( Exception e ){
+ e.printStackTrace();
+ return -1; // Error case
+ }
}
-
+
public static int run(){
- boolean[] condition = new boolean[5];
- conditionn[0] = test_is_true();
+ IO io = new IO();
+ String input_data = "abcdefg"; // Sample input
+ boolean[] condition = new boolean[3];
+
+ // Redirect IO streams
+ io.redirect_io(input_data);
+
+ // Execute function under test
+ int result = fut();
+
+ // Check stdout content
+ String stdout = io.get_out_content().toString();
+ condition[0] = stdout.equals("ab");
+
+ // Check stderr content
+ String stderr = io.get_err_content().toString();
+ condition[1] = stderr.equals("cd");
+
+ // Check returned character count (3 remaining characters: 'e' ,'f' ,'g')
+ condition[2] = result == 3;
+
+ // Restore original IO streams
+ io.restore_io();
- int i = 0;
if( !Util.all(condition) ){
System.out.println("TestIO failed");
return 1;
}
+ System.out.println("TestIO passed");
return 0;
}
// Main function to provide a shell interface for running tests
- public static int main(String[] args){
- // tests currently accepts no arguments or options
- return run(); // Calls the method to run all tests
+ public static void main(String[] args){
+ int return_code = run();
+ System.exit(return_code);
+ return;
}
-}
+
+}
--- /dev/null
+#!/bin/env bash
+java com.ReasoningTechnology.Mosaic.Test.Test0
--- /dev/null
+#!/bin/env bash
+java com.ReasoningTechnology.Mosaic.Test.TestIO
+++ /dev/null
-#!/bin/env bash
-java com.ReasoningTechnology."Mosaic_tester".TestBench.TestTestBench
-#!/bin/bash
+#!/usr/bin/env bash
-# Caveat: the 'shell' directory is for built wrapper functions. `clean_build_directories` will
-# remove all the files in this directory. For bespoke scripts used by the tester, put
-# them in the `tool` directory.
+# Caveat: the 'shell' directory is for built wrapper
+# functions. `clean_build_directories` will remove all the files in this
+# directory. For bespoke scripts used by the tester, put them in the `tool`
+# directory.
# input guards
env_must_be="tester/tool/env"
echo "Creating shell wrappers..."
mkdir -p shell
# wrapper is a space separated list
- wrapper=TestTestBench
+ wrapper=$(shell_wrapper_list)
for file in $wrapper;do
cat > shell/$file << EOL
#!/bin/env bash
-java com.ReasoningTechnology."$PROJECT".Test.$file
+java com.ReasoningTechnology.$PROJECT.Test.$file
EOL
chmod +x shell/$file
done
--- /dev/null
+#!/bin/bash
+
+# input guards
+env_must_be="tester/tool/env"
+if [ "$ENV" != "$env_must_be" ]; then
+ echo "$(script_fp):: error: must be run in the $env_must_be environment"
+ exit 1
+fi
+
+# space separated list of shell interface wrappers
+echo Test0 TestIO
+
--- /dev/null
+#!/bin/env bash
+java com.ReasoningTechnology."Mosaic_tester".Test.shell_wrapper_list
-#!/bin/bash
+#!/usr/bin/env bash
# Check if at least one file is provided
if [ $# -eq 0 ]; then
-#!/bin/bash
+#!/usr/bin/env bash
# cp subtree at <source> under file path <destination>, and make all the copied
# files read-only. The intended use case is for moving files to a `deprecated`
#!/bin/env bash
-# 2024-10-24T14:56:09Z extracted from Ariadne
-
-echo 0.1
+# 2024-10-24T14:56:09Z project skeleton and test bench files extracted from Ariadne
+echo v0.1
-#!/bin/bash
+#!/usr/bin/env bash
# remove all files in the release directory
set -e