aboutsummaryrefslogtreecommitdiffstats
path: root/Godeps/_workspace/src/github.com/ethereum/ethash/test
diff options
context:
space:
mode:
Diffstat (limited to 'Godeps/_workspace/src/github.com/ethereum/ethash/test')
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp52
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/test/go/ethash_test.go82
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/test/go/test.sh20
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/test/python/requirements.txt1
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test.sh4
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test_pyethash.py104
-rw-r--r--Godeps/_workspace/src/github.com/ethereum/ethash/test/test.sh7
7 files changed, 226 insertions, 44 deletions
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp b/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp
index 336713cb7..21cb251fc 100644
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/c/test.cpp
@@ -4,7 +4,9 @@
#include <libethash/internal.h>
#ifdef WITH_CRYPTOPP
+
#include <libethash/sha3_cryptopp.h>
+
#else
#include <libethash/sha3.h>
#endif // WITH_CRYPTOPP
@@ -28,7 +30,7 @@ BOOST_AUTO_TEST_CASE(fnv_hash_check) {
uint32_t x = 1235U;
const uint32_t
y = 9999999U,
- expected = (FNV_PRIME * x) ^ y;
+ expected = (FNV_PRIME * x) ^y;
x = fnv_hash(x, y);
@@ -65,43 +67,50 @@ BOOST_AUTO_TEST_CASE(SHA512_check) {
BOOST_AUTO_TEST_CASE(ethash_params_init_genesis_check) {
ethash_params params;
ethash_params_init(&params, 0);
- BOOST_REQUIRE_MESSAGE(params.full_size < DAGSIZE_BYTES_INIT,
+ BOOST_REQUIRE_MESSAGE(params.full_size < DATASET_BYTES_INIT,
"\nfull size: " << params.full_size << "\n"
- << "should be less than or equal to: " << DAGSIZE_BYTES_INIT << "\n");
- BOOST_REQUIRE_MESSAGE(params.full_size + 20*MIX_BYTES >= DAGSIZE_BYTES_INIT,
- "\nfull size + 20*MIX_BYTES: " << params.full_size + 20*MIX_BYTES << "\n"
- << "should be greater than or equal to: " << DAGSIZE_BYTES_INIT << "\n");
- BOOST_REQUIRE_MESSAGE(params.cache_size < DAGSIZE_BYTES_INIT / 32,
+ << "should be less than or equal to: " << DATASET_BYTES_INIT << "\n");
+ BOOST_REQUIRE_MESSAGE(params.full_size + 20 * MIX_BYTES >= DATASET_BYTES_INIT,
+ "\nfull size + 20*MIX_BYTES: " << params.full_size + 20 * MIX_BYTES << "\n"
+ << "should be greater than or equal to: " << DATASET_BYTES_INIT << "\n");
+ BOOST_REQUIRE_MESSAGE(params.cache_size < DATASET_BYTES_INIT / 32,
"\ncache size: " << params.cache_size << "\n"
- << "should be less than or equal to: " << DAGSIZE_BYTES_INIT / 32 << "\n");
+ << "should be less than or equal to: " << DATASET_BYTES_INIT / 32 << "\n");
}
BOOST_AUTO_TEST_CASE(ethash_params_init_genesis_calcifide_check) {
ethash_params params;
ethash_params_init(&params, 0);
const uint32_t expected_full_size = 1073739904;
- const uint32_t expected_cache_size = 1048384;
- BOOST_REQUIRE_MESSAGE(params.full_size == expected_full_size,
+ const uint32_t expected_cache_size = 16776896;
+ BOOST_REQUIRE_MESSAGE(params.full_size == expected_full_size,
"\nexpected: " << expected_cache_size << "\n"
<< "actual: " << params.full_size << "\n");
- BOOST_REQUIRE_MESSAGE(params.cache_size == expected_cache_size,
+ BOOST_REQUIRE_MESSAGE(params.cache_size == expected_cache_size,
"\nexpected: " << expected_cache_size << "\n"
<< "actual: " << params.cache_size << "\n");
}
BOOST_AUTO_TEST_CASE(light_and_full_client_checks) {
ethash_params params;
- uint8_t seed[32], hash[32];
+ uint8_t seed[32], hash[32], difficulty[32];
ethash_return_value light_out, full_out;
memcpy(seed, "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", 32);
memcpy(hash, "~~~X~~~~~~~~~~~~~~~~~~~~~~~~~~~~", 32);
+
+ // Set the difficulty
+ difficulty[0] = 197;
+ difficulty[1] = 90;
+ for (int i = 2; i < 32; i++)
+ difficulty[i] = (uint8_t) 255;
+
ethash_params_init(&params, 0);
params.cache_size = 1024;
params.full_size = 1024 * 32;
ethash_cache cache;
cache.mem = alloca(params.cache_size);
ethash_mkcache(&cache, &params, seed);
- node * full_mem = (node *) alloca(params.full_size);
+ node *full_mem = (node *) alloca(params.full_size);
ethash_compute_full_data(full_mem, &params, &cache);
{
@@ -115,7 +124,6 @@ BOOST_AUTO_TEST_CASE(light_and_full_client_checks) {
}
-
{
node node;
ethash_calculate_dag_item(&node, 0, &params, &cache);
@@ -128,7 +136,7 @@ BOOST_AUTO_TEST_CASE(light_and_full_client_checks) {
}
{
- for (int i = 0 ; i < params.full_size / sizeof(node) ; ++i ) {
+ for (int i = 0; i < params.full_size / sizeof(node); ++i) {
for (uint32_t j = 0; j < 32; ++j) {
node expected_node;
ethash_calculate_dag_item(&expected_node, j, &params, &cache);
@@ -187,6 +195,12 @@ BOOST_AUTO_TEST_CASE(light_and_full_client_checks) {
BOOST_REQUIRE_MESSAGE(full_mix_hash_string == light_mix_hash_string,
"\nlight mix hash: " << light_mix_hash_string.c_str() << "\n"
<< "full mix hash: " << full_mix_hash_string.c_str() << "\n");
+ BOOST_REQUIRE_MESSAGE(ethash_check_difficulty(full_out.result, difficulty),
+ "ethash_check_difficulty failed"
+ );
+ BOOST_REQUIRE_MESSAGE(ethash_quick_check_difficulty(hash, 5U, full_out.mix_hash, difficulty),
+ "ethash_quick_check_difficulty failed"
+ );
}
}
@@ -199,14 +213,14 @@ BOOST_AUTO_TEST_CASE(ethash_check_difficulty_check) {
memcpy(target, "22222222222222222222222222222222", 32);
BOOST_REQUIRE_MESSAGE(
ethash_check_difficulty(hash, target),
- "\nexpected \"" << hash << "\" to have less difficulty than \"" << target << "\"\n");
+ "\nexpected \"" << std::string((char *) hash, 32).c_str() << "\" to have the same or less difficulty than \"" << std::string((char *) target, 32).c_str() << "\"\n");
BOOST_REQUIRE_MESSAGE(
- !ethash_check_difficulty(hash, hash),
- "\nexpected \"" << hash << "\" to have the same difficulty as \"" << hash << "\"\n");
+ ethash_check_difficulty(hash, hash),
+ "\nexpected \"" << hash << "\" to have the same or less difficulty than \"" << hash << "\"\n");
memcpy(target, "11111111111111111111111111111112", 32);
BOOST_REQUIRE_MESSAGE(
ethash_check_difficulty(hash, target),
- "\nexpected \"" << hash << "\" to have less difficulty than \"" << target << "\"\n");
+ "\nexpected \"" << hash << "\" to have the same or less difficulty than \"" << target << "\"\n");
memcpy(target, "11111111111111111111111111111110", 32);
BOOST_REQUIRE_MESSAGE(
!ethash_check_difficulty(hash, target),
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/go/ethash_test.go b/Godeps/_workspace/src/github.com/ethereum/ethash/test/go/ethash_test.go
new file mode 100644
index 000000000..67ca51702
--- /dev/null
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/go/ethash_test.go
@@ -0,0 +1,82 @@
+package ethashTest
+
+import (
+ "bytes"
+ "crypto/rand"
+ "encoding/hex"
+ "log"
+ "math/big"
+ "testing"
+
+ "github.com/ethereum/ethash"
+ "github.com/ethereum/go-ethereum/core"
+ "github.com/ethereum/go-ethereum/ethdb"
+)
+
+func TestEthash(t *testing.T) {
+ seedHash := make([]byte, 32)
+ _, err := rand.Read(seedHash)
+ if err != nil {
+ panic(err)
+ }
+
+ db, err := ethdb.NewMemDatabase()
+ if err != nil {
+ panic(err)
+ }
+
+ blockProcessor, err := core.NewCanonical(5, db)
+ if err != nil {
+ panic(err)
+ }
+
+ log.Println("Block Number: ", blockProcessor.ChainManager().CurrentBlock().Number())
+
+ e := ethash.New(blockProcessor.ChainManager())
+
+ miningHash := make([]byte, 32)
+ if _, err := rand.Read(miningHash); err != nil {
+ panic(err)
+ }
+ diff := big.NewInt(10000)
+ log.Println("difficulty", diff)
+
+ nonce := uint64(0)
+
+ ghash_full := e.FullHash(nonce, miningHash)
+ log.Printf("ethash full (on nonce): %x %x\n", ghash_full, nonce)
+
+ ghash_light := e.LightHash(nonce, miningHash)
+ log.Printf("ethash light (on nonce): %x %x\n", ghash_light, nonce)
+
+ if bytes.Compare(ghash_full, ghash_light) != 0 {
+ t.Errorf("full: %x, light: %x", ghash_full, ghash_light)
+ }
+}
+
+func TestGetSeedHash(t *testing.T) {
+ seed0, err := ethash.GetSeedHash(0)
+ if err != nil {
+ t.Errorf("Failed to get seedHash for block 0: %v", err)
+ }
+ if bytes.Compare(seed0, []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}) != 0 {
+ log.Printf("seedHash for block 0 should be 0s, was: %v\n", seed0)
+ }
+ seed1, err := ethash.GetSeedHash(30000)
+ if err != nil {
+ t.Error(err)
+ }
+
+ // From python:
+ // > from pyethash import get_seedhash
+ // > get_seedhash(30000)
+ expectedSeed1, err := hex.DecodeString("290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e563")
+ if err != nil {
+ t.Error(err)
+ }
+
+ if bytes.Compare(seed1, expectedSeed1) != 0 {
+ log.Printf("seedHash for block 1 should be: %v,\nactual value: %v\n", expectedSeed1, seed1)
+ }
+
+}
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/go/test.sh b/Godeps/_workspace/src/github.com/ethereum/ethash/test/go/test.sh
new file mode 100644
index 000000000..c6224858e
--- /dev/null
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/go/test.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+# Strict mode
+set -e
+
+SOURCE="${BASH_SOURCE[0]}"
+while [ -h "$SOURCE" ]; do
+ DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+ SOURCE="$(readlink "$SOURCE")"
+ [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
+done
+TEST_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
+
+export GOPATH=${HOME}/.go
+export PATH=$PATH:$GOPATH/bin
+echo "# getting go dependencies (can take some time)..."
+cd ${TEST_DIR}/../.. && go get
+cd ${GOPATH}/src/github.com/ethereum/go-ethereum
+git checkout poc-9
+cd ${TEST_DIR} && go test
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/requirements.txt b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/requirements.txt
index 1f38dc3c7..378263c62 100644
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/requirements.txt
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/requirements.txt
@@ -1,2 +1,3 @@
pyethereum==0.7.522
nose==1.3.4
+pysha3==0.3 \ No newline at end of file
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test.sh b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test.sh
index 4a547d157..95cea0215 100644
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test.sh
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test.sh
@@ -14,6 +14,6 @@ TEST_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
[ -d $TEST_DIR/python-virtual-env ] || virtualenv --system-site-packages $TEST_DIR/python-virtual-env
source $TEST_DIR/python-virtual-env/bin/activate
pip install -r $TEST_DIR/requirements.txt > /dev/null
-pip install -e $TEST_DIR/../.. > /dev/null
+pip install --upgrade --no-deps --force-reinstall -e $TEST_DIR/../..
cd $TEST_DIR
-nosetests --with-doctest -v
+nosetests --with-doctest -v --nocapture
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test_pyethash.py b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test_pyethash.py
index ca9321e92..7eb1b60c7 100644
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test_pyethash.py
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/python/test_pyethash.py
@@ -4,42 +4,102 @@ from random import randint
def test_get_cache_size_not_None():
for _ in range(100):
block_num = randint(0,12456789)
- out = pyethash.core.get_cache_size(block_num)
+ out = pyethash.get_cache_size(block_num)
assert out != None
def test_get_full_size_not_None():
for _ in range(100):
block_num = randint(0,12456789)
- out = pyethash.core.get_full_size(block_num)
+ out = pyethash.get_full_size(block_num)
assert out != None
def test_get_cache_size_based_on_EPOCH():
for _ in range(100):
block_num = randint(0,12456789)
- out1 = pyethash.core.get_cache_size(block_num)
- out2 = pyethash.core.get_cache_size((block_num // pyethash.EPOCH_LENGTH) * pyethash.EPOCH_LENGTH)
+ out1 = pyethash.get_cache_size(block_num)
+ out2 = pyethash.get_cache_size((block_num // pyethash.EPOCH_LENGTH) * pyethash.EPOCH_LENGTH)
assert out1 == out2
def test_get_full_size_based_on_EPOCH():
for _ in range(100):
block_num = randint(0,12456789)
- out1 = pyethash.core.get_full_size(block_num)
- out2 = pyethash.core.get_full_size((block_num // pyethash.EPOCH_LENGTH) * pyethash.EPOCH_LENGTH)
+ out1 = pyethash.get_full_size(block_num)
+ out2 = pyethash.get_full_size((block_num // pyethash.EPOCH_LENGTH) * pyethash.EPOCH_LENGTH)
assert out1 == out2
-#def test_get_params_based_on_EPOCH():
-# block_num = 123456
-# out1 = pyethash.core.get_params(block_num)
-# out2 = pyethash.core.get_params((block_num // pyethash.EPOCH_LENGTH) * pyethash.EPOCH_LENGTH)
-# assert out1["DAG Size"] == out2["DAG Size"]
-# assert out1["Cache Size"] == out2["Cache Size"]
-#
-#def test_get_params_returns_different_values_based_on_different_block_input():
-# out1 = pyethash.core.get_params(123456)
-# out2 = pyethash.core.get_params(12345)
-# assert out1["DAG Size"] != out2["DAG Size"]
-# assert out1["Cache Size"] != out2["Cache Size"]
-#
-#def test_get_cache_smoke_test():
-# params = pyethash.core.get_params(123456)
-# assert pyethash.core.mkcache(params, "~~~~") != None
+# See light_and_full_client_checks in test.cpp
+def test_mkcache_is_as_expected():
+ actual = pyethash.mkcache_bytes(
+ 1024,
+ "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~").encode('hex')
+ expected = "2da2b506f21070e1143d908e867962486d6b0a02e31d468fd5e3a7143aafa76a14201f63374314e2a6aaf84ad2eb57105dea3378378965a1b3873453bb2b78f9a8620b2ebeca41fbc773bb837b5e724d6eb2de570d99858df0d7d97067fb8103b21757873b735097b35d3bea8fd1c359a9e8a63c1540c76c9784cf8d975e995ca8620b2ebeca41fbc773bb837b5e724d6eb2de570d99858df0d7d97067fb8103b21757873b735097b35d3bea8fd1c359a9e8a63c1540c76c9784cf8d975e995ca8620b2ebeca41fbc773bb837b5e724d6eb2de570d99858df0d7d97067fb8103b21757873b735097b35d3bea8fd1c359a9e8a63c1540c76c9784cf8d975e995c259440b89fa3481c2c33171477c305c8e1e421f8d8f6d59585449d0034f3e421808d8da6bbd0b6378f567647cc6c4ba6c434592b198ad444e7284905b7c6adaf70bf43ec2daa7bd5e8951aa609ab472c124cf9eba3d38cff5091dc3f58409edcc386c743c3bd66f92408796ee1e82dd149eaefbf52b00ce33014a6eb3e50625413b072a58bc01da28262f42cbe4f87d4abc2bf287d15618405a1fe4e386fcdafbb171064bd99901d8f81dd6789396ce5e364ac944bbbd75a7827291c70b42d26385910cd53ca535ab29433dd5c5714d26e0dce95514c5ef866329c12e958097e84462197c2b32087849dab33e88b11da61d52f9dbc0b92cc61f742c07dbbf751c49d7678624ee60dfbe62e5e8c47a03d8247643f3d16ad8c8e663953bcda1f59d7e2d4a9bf0768e789432212621967a8f41121ad1df6ae1fa78782530695414c6213942865b2730375019105cae91a4c17a558d4b63059661d9f108362143107babe0b848de412e4da59168cce82bfbff3c99e022dd6ac1e559db991f2e3f7bb910cefd173e65ed00a8d5d416534e2c8416ff23977dbf3eb7180b75c71580d08ce95efeb9b0afe904ea12285a392aff0c8561ff79fca67f694a62b9e52377485c57cc3598d84cac0a9d27960de0cc31ff9bbfe455acaa62c8aa5d2cce96f345da9afe843d258a99c4eaf3650fc62efd81c7b81cd0d534d2d71eeda7a6e315d540b4473c80f8730037dc2ae3e47b986240cfc65ccc565f0d8cde0bc68a57e39a271dda57440b3598bee19f799611d25731a96b5dbbbefdff6f4f656161462633030d62560ea4e9c161cf78fc96a2ca5aaa32453a6c5dea206f766244e8c9d9a8dc61185ce37f1fc804459c5f07434f8ecb34141b8dcae7eae704c950b55556c5f40140c3714b45eddb02637513268778cbf937a33e4e33183685f9deb31ef54e90161e76d969587dd782eaa94e289420e7c2ee908517f5893a26fdb5873d68f92d118d4bcf98d7a4916794d6ab290045e30f9ea00ca547c584b8482b0331ba1539a0f2714fddc3a0b06b0cfbb6a607b8339c39bcfd6640b1f653e9d70ef6c985b"
+ assert actual == expected
+
+def test_calc_dataset_is_not_None():
+ cache = pyethash.mkcache_bytes(
+ 1024,
+ "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
+ assert pyethash.calc_dataset_bytes(1024 * 32, cache) != None
+
+def test_light_and_full_agree():
+ cache = pyethash.mkcache_bytes(
+ 1024,
+ "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
+ full_size = 1024 * 32
+ header = "~~~~~X~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ light_result = pyethash.hashimoto_light(full_size, cache, header, 0)
+ dataset = pyethash.calc_dataset_bytes(full_size, cache)
+ full_result = pyethash.hashimoto_full(dataset, header, 0)
+ assert light_result["mix digest"] != None
+ assert len(light_result["mix digest"]) == 32
+ assert light_result["mix digest"] == full_result["mix digest"]
+ assert light_result["result"] != None
+ assert len(light_result["result"]) == 32
+ assert light_result["result"] == full_result["result"]
+
+def int_to_bytes(i):
+ b = []
+ for _ in range(32):
+ b.append(chr(i & 0xff))
+ i >>= 8
+ b.reverse()
+ return "".join(b)
+
+def test_mining_basic():
+ easy_difficulty = int_to_bytes(2**256 - 1)
+ assert easy_difficulty.encode('hex') == 'f' * 64
+ cache = pyethash.mkcache_bytes(
+ 1024,
+ "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
+ full_size = 1024 * 32
+ header = "~~~~~X~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ dataset = pyethash.calc_dataset_bytes(full_size, cache)
+ # Check type of outputs
+ assert type(pyethash.mine(dataset,header,easy_difficulty)) == dict
+ assert type(pyethash.mine(dataset,header,easy_difficulty)["nonce"]) == long
+ assert type(pyethash.mine(dataset,header,easy_difficulty)["mix digest"]) == str
+ assert type(pyethash.mine(dataset,header,easy_difficulty)["result"]) == str
+
+def test_mining_doesnt_always_return_the_same_value():
+ easy_difficulty1 = int_to_bytes(int(2**256 * 0.999))
+ # 1 in 1000 difficulty
+ easy_difficulty2 = int_to_bytes(int(2**256 * 0.001))
+ assert easy_difficulty1 != easy_difficulty2
+ cache = pyethash.mkcache_bytes(
+ 1024,
+ "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
+ full_size = 1024 * 32
+ header = "~~~~~X~~~~~~~~~~~~~~~~~~~~~~~~~~"
+ dataset = pyethash.calc_dataset_bytes(full_size, cache)
+ # Check type of outputs
+ assert pyethash.mine(dataset, header, easy_difficulty1)['nonce'] != pyethash.mine(dataset, header, easy_difficulty2)['nonce']
+
+def test_get_seedhash():
+ assert pyethash.get_seedhash(0).encode('hex') == '0' * 64
+ import hashlib, sha3
+ expected = pyethash.get_seedhash(0)
+ #print "checking seed hashes:",
+ for i in range(0, 30000*2048, 30000):
+ #print i // 30000,
+ assert pyethash.get_seedhash(i) == expected
+ expected = hashlib.sha3_256(expected).digest()
diff --git a/Godeps/_workspace/src/github.com/ethereum/ethash/test/test.sh b/Godeps/_workspace/src/github.com/ethereum/ethash/test/test.sh
index eb38f6dfc..fd3508609 100644
--- a/Godeps/_workspace/src/github.com/ethereum/ethash/test/test.sh
+++ b/Godeps/_workspace/src/github.com/ethereum/ethash/test/test.sh
@@ -14,7 +14,12 @@ TEST_DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
echo -e "\n################# Testing JS ##################"
# TODO: Use mocha and real testing tools instead of rolling our own
cd $TEST_DIR/../js
-node test.js
+if [ -x "$(which nodejs)" ] ; then
+ nodejs test.js
+fi
+if [ -x "$(which node)" ] ; then
+ node test.js
+fi
echo -e "\n################# Testing C ##################"
$TEST_DIR/c/test.sh