From 8159e874e9029ac87cbefc76381897249440d7c6 Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Wed, 31 Oct 2018 00:13:10 +0100 Subject: [PATCH] All in one package --- .../{{cookiecutter.julia_package_name}}.jl | 2 ++ .../test/runtests.jl | 23 ++++++++----------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/{{cookiecutter.github_project_name}}/src/{{cookiecutter.julia_package_name}}.jl b/{{cookiecutter.github_project_name}}/src/{{cookiecutter.julia_package_name}}.jl index 5f7a462..e176e75 100644 --- a/{{cookiecutter.github_project_name}}/src/{{cookiecutter.julia_package_name}}.jl +++ b/{{cookiecutter.github_project_name}}/src/{{cookiecutter.julia_package_name}}.jl @@ -9,4 +9,6 @@ if !isfile(depsfile) end include(depsfile) +@wrapmodule _l_examples + end diff --git a/{{cookiecutter.github_project_name}}/test/runtests.jl b/{{cookiecutter.github_project_name}}/test/runtests.jl index a550af7..848297a 100644 --- a/{{cookiecutter.github_project_name}}/test/runtests.jl +++ b/{{cookiecutter.github_project_name}}/test/runtests.jl @@ -7,27 +7,22 @@ ############################################################################ using Test - -module TensorFunctions -using CxxWrap -using {{ cookiecutter.julia_package_name }} -@wrapmodule {{ cookiecutter.julia_package_name }}._l_examples -end +using {{ cookiecutter.julia_package_name }} # Test example functions from the TensorFunctions module # example1 arr = [[1.0 2.0] [3.0 4.0]] -@test TensorFunctions.test_access(arr) == 4.0 -@test TensorFunctions.example1([4., 5., 6.]) == 4.0 +@test {{ cookiecutter.julia_package_name }}.test_access(arr) == 4.0 +@test {{ cookiecutter.julia_package_name }}.example1([4., 5., 6.]) == 4.0 # example2 x = [[0. 1.] [2. 3.]] res = [[2. 3.] [4. 5.]] -y = TensorFunctions.example2(x) +y = {{ cookiecutter.julia_package_name }}.example2(x) @test y ≈ res atol=1e-12 # vectorize_example1 @@ -36,7 +31,7 @@ x1 = [[0 1] x2 = [0, 1] res = [[0 2] [2 4]] -y = TensorFunctions.vectorize_example1(x1, x2) +y = {{ cookiecutter.julia_package_name }}.vectorize_example1(x1, x2) @test y == res # readme_example1 @@ -44,7 +39,7 @@ v = [[0.0 3.0 6.0 9.0 12.0] [1.0 4.0 7.0 10.0 13.0] [2.0 5.0 8.0 11.0 14.0]] -y = TensorFunctions.readme_example1(v) +y = {{ cookiecutter.julia_package_name }}.readme_example1(v) @test y ≈ 1.2853996391883833 atol=1e-12 # readme_example2 @@ -52,7 +47,7 @@ x = [[ 0.0 1.0 2.0 3.0 4.0] [ 5.0 6.0 7.0 8.0 9.0] [10.0 11.0 12.0 13.0 14.0]] y = [1.0, 2.0, 3.0, 4.0, 5.0] -z = TensorFunctions.readme_example2(x, y) +z = {{ cookiecutter.julia_package_name }}.readme_example2(x, y) expected = [[-0.540302 1.257618 1.89929 0.794764 -1.040465] [-1.499227 0.136731 1.646979 1.643002 0.128456] [-1.084323 -0.583843 0.45342 1.073811 0.706945]] @@ -62,5 +57,5 @@ expected = [[-0.540302 1.257618 1.89929 0.794764 -1.040465] x = ones(4, 4) y = ones(5, 5) z = zeros(4, 4) -@assert !TensorFunctions.compare_shapes(x, y) -@assert TensorFunctions.compare_shapes(x, z) +@assert !{{ cookiecutter.julia_package_name }}.compare_shapes(x, y) +@assert {{ cookiecutter.julia_package_name }}.compare_shapes(x, z)