Compare commits

..

No commits in common. "main" and "0.2" have entirely different histories.
main ... 0.2

21 changed files with 181 additions and 178 deletions

View File

@ -1,21 +1,21 @@
#!/usr/bin/bash
# File: HelloWorld.bash
#
# Description: This file exemplifies printing 'Hello, World!' in bash.
#
#
# Description: This file exemplifies printing 'Hello world!' in bash.
#
# Package: AniNIX/HelloWorld
# Copyright: WTFPL
#
#
# Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
### String to print
export _helloWorld="Hello, World!"
### String to print
export _helloWorld="Hello world!"
### Prints 'Hello, World!'
### Prints 'Hello world!'
### </summary>
function main() {
function main() {
printf "$_helloWorld""\n"
}

View File

@ -2,19 +2,19 @@
/*
* File: HelloWorld.c
*
* Description: This file exemplifies printing 'Hello, World!' in C.
*
*
* Description: This file exemplifies printing 'Hello world!' in C.
*
* Package: AniNIX/HelloWorld
* Copyright: WTFPL
*
*
* Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
*/
static char * message = "Hello, World!";
static char * message = "Hello world!";
/// <summary>
/// Prints 'Hello, World!'
/// Prints 'Hello world!'
/// </summary>
void HelloWorld() {
printf("%s\n",message);

View File

@ -2,12 +2,12 @@ using System;
/*
* File: HelloWorld.cs
*
* Description: This file exemplifies printing 'Hello, World!' in C#.
*
*
* Description: This file exemplifies printing 'Hello world!' in C#.
*
* Package: AniNIX/HelloWorld
* Copyright: WTFPL
*
*
* Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
*/
@ -17,12 +17,12 @@ namespace AniNIX {
public sealed class HelloWorld {
// String to print
private static String _helloWorld="Hello, World!";
private static String _helloWorld="Hello world!";
/// <summary>
/// Print 'Hello, World!'
/// Print 'Hello world!'
/// </summary>
public static void PrintHelloWorld() {
public static void PrintHelloWorld() {
Console.WriteLine(_helloWorld);
}

View File

@ -2,30 +2,30 @@ import java.lang.System;
/*
* File: HelloWorld.java
*
* Description: This file exemplifies printing 'Hello, World!' in Java.
*
*
* Description: This file exemplifies printing 'Hello world!' in Java.
*
* Package: AniNIX/HelloWorld
* Copyright: WTFPL
*
*
* Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
*/
/// This class is used exemplify coding standard in Java
public class HelloWorld {
public class HelloWorld {
// String to print
private static String _helloWorld = "Hello, World!";
private static String _helloWorld = "Hello world!";
/// <summary>
/// Print 'Hello, World!'
/// Print 'Hello world!'
/// </summary>
public static void PrintHelloWorld() {
System.out.println(_helloWorld);
}
/// MAIN
public static void main(String[] args) {
/// MAIN
public static void main(String[] args) {
PrintHelloWorld();
}
}

View File

@ -1,22 +1,22 @@
<?php
# File: HelloWorld.php
#
# Description: This file exemplifies printing 'Hello, World!' in PHP.
#
#
# Description: This file exemplifies printing 'Hello world!' in PHP.
#
# Package: AniNIX/HelloWorld
# Copyright: WTFPL
#
#
# Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
### String to print
$_helloWorld="Hello, World!";
$_helloWorld="Hello world!";
### <summary>
### Prints 'Hello, World!'
### Prints 'Hello world!'
### </summary>
function PrintHelloWorld() {
function PrintHelloWorld() {
global $_helloWorld;
echo $_helloWorld."\n";

View File

@ -1,19 +1,19 @@
#!/usr/bin/perl
# File: HelloWorld.pl
#
# Description: This file exemplifies printing 'Hello, World!' in perl.
#
#
# Description: This file exemplifies printing 'Hello world!' in perl.
#
# Package: AniNIX/HelloWorld
# Copyright: WTFPL
#
#
# Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
### <summary>
### Prints 'Hello, World!'
### Prints 'Hello world!'
### </summary>
sub PrintHelloWorld {
print "Hello, World!\n"
print "Hello world!\n"
}
### MAIN

View File

@ -1,21 +1,21 @@
#!/usr/bin/env python3
# File: HelloWorld.py
#
# Description: This file exemplifies printing 'Hello, World!' in python.
#
#
# Description: This file exemplifies printing 'Hello world!' in python.
#
# Package: AniNIX/HelloWorld
# Copyright: WTFPL
#
#
# Author: DarkFeather <ircs://aninix.net:6697/DarkFeather>
### String to print
_helloWorld='Hello, World!'
### String to print
_helloWorld='Hello world!'
### <summary>
### Prints 'Hello, World!'
### Prints 'Hello world!'
### </summary>
def PrintHelloWorld():
def PrintHelloWorld():
print(_helloWorld)
### Main

58
LICENSE
View File

@ -1,31 +1,27 @@
# http://www.wtfpl.net/about/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
ANINIX ADDENDUM
Trademark 2017 (https://aninix.net/)
The "AniNIX" name and |> logo are trademarked as of 2017/11/21.
AniNIX materials may be reproduced and re-used (though you must
contact the admins of the network to get written permission to use
the AniNIX name or logo) so long as such reproduction or re-use
does not inhibit the original AniNIX use of the same.
Attribution is appreciated for other materials but not legally
required or necessary.
"AniNIX" trademark serial: 87177883
|> Logo trademark serial: 87177887
# http://www.wtfpl.net/about/
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
ANINIX ADDENDUM
Trademark Pending 2017 (https://aninix.net/irc/)
The "AniNIX" name and |> logo is trademark-pending as of 2017. All
AniNIX materials can be reproduced and re-used, though you must
contact the admins of the network to get written permission to use
the AniNIX name.
Attribution is appreciated for other materials but not legally
required or necessary.

View File

@ -7,29 +7,29 @@ install: clean compile
mkdir -p ${pkgdir}/opt/aninix/${pkgdirname}/
install -o root -m 0644 ./HelloWorld* ${pkgdir}/opt/aninix/${pkgdirname}/
clean:
test: compile
python3 -m pytest
clean:
for i in `cat .gitignore`; do /bin/bash -c "rm -Rf $$i"; done
uninstall:
rm -Rf ${pkgdir}/opt/aninix/${pkgdirname}/
test: compile
python3 -m pytest
diff:
@echo Nothing to do.
reverse:
@echo Nothing to do.
checkperm:
@echo Nothing to do.
diff:
@echo Nothing to do.
reverse:
@echo Nothing to do.
c: HelloWorld.c /usr/bin/gcc
gcc -o HelloWorld HelloWorld.c
java: HelloWorld.java /usr/bin/javac /usr/bin/java
/usr/bin/javac HelloWorld.java
java: HelloWorld.java /usr/lib/jvm/java-18-openjdk/bin/javac /usr/lib/jvm/java-18-openjdk/bin/java
/usr/lib/jvm/java-18-openjdk/bin/javac HelloWorld.java
bash: HelloWorld.bash /usr/bin/bash
#bash HelloWorld.bash

View File

@ -10,7 +10,7 @@ arch=("x86_64")
url="https://aninix.net/foundation/${pkgname}"
license=('custom')
groups=()
depends=('bash>=4.4' 'php' 'perl' 'jdk-openjdk>=20.0.2.u9-3' 'python>=3.7')
depends=('bash>=4.4' 'php' 'perl' 'jdk-openjdk>=18.0.1.1.u2-1' 'jre-openjdk-headless>=18.0.1.1.u2-1' 'python>=3.7')
makedepends=('make>=4.2' 'mono>5.0.0' 'gcc' 'python-pytest')
checkdepends=()
optdepends=()

View File

@ -1,20 +1,3 @@
This project is tracking basic standards of reference for getting started with various programming languages. That standard has always been a program that prints "Hello, World!"
AniNIX::HelloWorld \\ Sample HelloWorld Source
# Etymology
A program called ["Hello, World!"](https://en.wikipedia.org/wiki/%22Hello,_World!%22_program) has been a mainstay of computing for a long time, with some thinking it began with BCPL in 1967. Regardless, it is a common teaching tool for new programmers, and it is a way for a language to announce itself to the world.
# Relevant Files and Software
The relevant software for this is any executing engine for a language included in the project. For languages like C, they compile into local executables -- languages like Java & C# create compiled entities that need to execute within their runtime. Others, like Python & PHP, don't compile but execute within their respective binaries. Check the [test units](/AniNIX/HelloWorld/src/branch/main/tests) file for more details on invocation.
## Java
Per [ArchWiki's notes on Java](https://wiki.archlinux.org/title/Java#Installation), you need to use `archlinux-java` to set your java environment. We typically use the latest Java available.
# Available Clients
There are none. This is a demo repo for teaching purposes.
# Equivalents or Competition
Many good products for teaching computing, including [W3Schools](https://www.w3schools.com/), [Codingame](https://www.codingame.com/home), [Khan Academy](https://www.khanacademy.org/computing/computer-programming), and others exist. We encourage all our new developers to look up various paths to learn to code -- it's a highly rewarding track to pursue.
This project is enabled for AniNIX::Foundation. You can check it out remotely with the git package. It is intended to display example source for all of our projects.

View File

@ -1,22 +0,0 @@
#!/bin/bash
#
# Find that we have tests for each file.
retcode=0
for language in `ls -1 ./HelloWorld.* | cut -f 3 -d '.'`; do
# Ensure there's a test file.
if [ ! -f tests/test_"${language}".py ]; then
echo "${language^} is missing a test file."
retcode=1
else
# Ensure that each test is defined.
if ! grep "^def test_${language}():$" tests/test_"${language}".py &>/dev/null; then
echo "${language^} doesn't have the right test definition."
retcode=1
fi
fi
done
exit $retcode

View File

@ -7,7 +7,7 @@ def checkOutput(output):
Ensure hello world is in string.
return: whether hello world is present
"""
return output == 'Hello, World!\n'
return output == 'Hello world!\n'
def runCommand(command):
"""
@ -16,11 +16,12 @@ def runCommand(command):
return: Whether retcode is 0
"""
fh = os.popen(command, mode='r', buffering=-1)
fh.read()
output = fh.read()
retcode = fh.close()
return retcode == None
assert retcode == None
def runCommandAndCheckOutput(command):
def runCommandAndOutputCheck(command):
"""
Define a function to run a shell command and ensure output is correct
param command: command
@ -29,4 +30,4 @@ def runCommandAndCheckOutput(command):
fh = os.popen(command, mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
return retcode == None and checkOutput(output)
assert retcode == None and CheckOutput(output)

View File

@ -1,6 +0,0 @@
import os
import shutil
from tests.global_fns import *
def test_bash():
runCommandAndCheckOutput("./HelloWorld.bash")

View File

@ -1,6 +1,24 @@
import os
import re
import shutil
from tests.global_fns import *
def test_compile_c():
fh = os.popen("gcc -o HelloWorld ./HelloWorld.c", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None
def test_c():
runCommandAndCheckOutput("./HelloWorld")
fh = os.popen("./HelloWorld", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None and checkOutput(output)
def test_c_cleanup():
fh = os.popen("rm ./HelloWorld", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None

View File

@ -1,6 +0,0 @@
import os
import shutil
from tests.global_fns import *
def test_cs():
runCommandAndCheckOutput("mono ./HelloWorld.exe")

View File

@ -1,6 +0,0 @@
import os
import shutil
from tests.global_fns import *
def test_java():
runCommandAndCheckOutput("/usr/bin/java HelloWorld")

View File

@ -1,6 +0,0 @@
import os
import shutil
from tests.global_fns import *
def test_php():
runCommandAndCheckOutput("php ./HelloWorld.php")

View File

@ -1,6 +0,0 @@
import os
import shutil
from tests.global_fns import *
def test_pl():
runCommandAndCheckOutput("")

View File

@ -1,6 +0,0 @@
import os
import shutil
from tests.global_fns import *
def test_py():
runCommandAndCheckOutput("./HelloWorld.py")

63
tests/test_unit.py Normal file
View File

@ -0,0 +1,63 @@
import os
import re
import shutil
def CheckOutput(output):
return output == 'Hello world!\n'
def test_make():
print(os.getcwd())
fh = os.popen("/bin/bash -c 'make compile'", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None
def test_c():
print(os.getcwd())
fh = os.popen("./HelloWorld", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None and CheckOutput(output)
def test_cs():
print(os.getcwd())
fh = os.popen("mono ./HelloWorld.exe", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None and CheckOutput(output)
def test_java():
print(os.getcwd())
fh = os.popen("/usr/lib/jvm/java-18-openjdk/bin/java HelloWorld", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None and CheckOutput(output)
def test_bash():
print(os.getcwd())
fh = os.popen("./HelloWorld.bash", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None and CheckOutput(output)
def test_perl():
print(os.getcwd())
fh = os.popen("./HelloWorld.pl", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None and CheckOutput(output)
def test_php():
print(os.getcwd())
fh = os.popen("php ./HelloWorld.php", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None and CheckOutput(output)
def test_python():
print(os.getcwd())
fh = os.popen("./HelloWorld.py", mode='r', buffering=-1)
output = fh.read()
retcode = fh.close()
assert retcode == None and CheckOutput(output)