commit fce4e045a8dfea225eac35fbf3d20ff3a67d4b41
parent aae18d55d80bfcf2c29d7a656ae9ec6ee4722065
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Thu, 10 Nov 2016 11:40:53 +0100
Push further the parsing tests
Diffstat:
6 files changed, 315 insertions(+), 0 deletions(-)
diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt
@@ -85,8 +85,12 @@ if(NOT NO_TEST)
build_test(test_solstice_parser)
add_test(test_solstice_parser_ok_0 test_solstice_parser
${SOLSTICE_SOURCE_DIR}/yaml/test_ok_0.yaml)
+ add_test(test_solstice_parser_ok_1 test_solstice_parser
+ ${SOLSTICE_SOURCE_DIR}/yaml/test_ok_1.yaml)
add_test(test_solstice_parser_ko_0 test_solstice_parser -e
${SOLSTICE_SOURCE_DIR}/yaml/test_ko_0.yaml)
+ add_test(test_solstice_parser_ko_1 test_solstice_parser -e
+ ${SOLSTICE_SOURCE_DIR}/yaml/test_ko_1.yaml)
endif()
################################################################################
diff --git a/src/yaml/test_ko_0.yaml b/src/yaml/test_ko_0.yaml
@@ -81,3 +81,84 @@ instance:
---
- instance:
transform: { translation: [ 3, 4, 4 ] }
+---
+- instance:
+ object:
+ material: { matte: { reflectivity: } }
+ cuboid: { size: [ 0, 1, 3 ] }
+---
+- instance:
+ object:
+ material: { matte: { reflectivity: 1, dummy: "none" } }
+ cuboid: { size: [1, 2, 3] }
+---
+- instance:
+ object:
+ material:
+ matte: { reflectivity: 1 }
+ dummy: 123
+ cuboid: { size: [1, 2, 3] }
+---
+- instance:
+ object:
+ material: { matte: { reflectivity: 1 } }
+ cuboid: { size: [1, 2, 3], dummy: 3.14 }
+---
+- instance:
+ object:
+ material: { matte: { reflectivity: 1 } }
+ cuboid: { size: [1, 2, 3] }
+ dummy: 1
+---
+- instance:
+ object:
+ material: { matte: { reflectivity: 1 } }
+ cuboid: { size: [1, 2, 3] }
+ dummy: 1
+---
+- material: &front { matte: { reflectivity: 1 } }
+- material: &back { matte: { reflectivity: 0.5 } }
+- object: &cuboid
+ cuboid: { size: [1, 2, 3] }
+ material:
+ front: *front
+ back: *back
+ front: *front
+- instance: { object: *cuboid }
+---
+- material: &front { matte: { reflectivity: 1 } }
+- material: &back { matte: { reflectivity: 0.5 } }
+- object: &cuboid
+ cuboid: { size: [1, 2, 3] }
+ material:
+ front: *front
+- instance: { object: *cuboid }
+---
+- material: &front { matte: { reflectivity: 1 } }
+- material: &back { matte: { reflectivity: 0.5 } }
+- object: &cuboid
+ cuboid: { size: [1, 2, 3] }
+ material:
+ back: *back
+- instance: { object: *cuboid }
+---
+- object: &cuboid
+ cuboid: { size: [1, 2, 3] }
+ material:
+ front:
+ matte: { reflectivity: 1 }
+ dummy: 1
+ back:
+ material: { matte: { reflectivity: 0.1 } }
+- instance: { object: *cuboid }
+---
+- object: &cuboid
+ cuboid: { size: [1, 2, 3] }
+ material:
+ front:
+ matte: { reflectivity: 1 }
+ back:
+ matte: { reflectivity: 0.1 }
+ dummy: 1234
+- instance: { object: *cuboid }
+
diff --git a/src/yaml/test_ko_1.yaml b/src/yaml/test_ko_1.yaml
@@ -0,0 +1,143 @@
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1.1, roughness: 0 } }
+ cylinder: { height: 1, radius: 1 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: -0.1, roughness: 0 } }
+ cylinder: { height: 1, radius: 1 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 0, roughness: -0.1 } }
+ cylinder: { height: 1, radius: 1 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 0, roughness: 1.000001 } }
+ cylinder: { height: 1, radius: 1 }
+---
+- material: &mirror
+ mirror:
+ reflectivity: 0
+ reflectivity: 1
+ roughness: 0
+- instance:
+ object:
+ material: *mirror
+ cylinder: { height: 1, radius: 1 }
+---
+- material: &mirror
+ mirror:
+ reflectivity: 1
+ roughness: 0
+ roughness: 1
+- instance:
+ object:
+ material: *mirror
+ cylinder: { height: 1, radius: 1 }
+---
+- material: &mirror
+ mirror:
+ reflectivity:
+ roughness: 1
+- instance:
+ object:
+ material: *mirror
+ cylinder: { height: 1, radius: 1 }
+---
+- material: &mirror
+ mirror:
+ reflectivity: 1
+ roughness:
+- instance:
+ object:
+ material: *mirror
+ cylinder: { height: 1, radius: 1 }
+---
+- material: &mirror
+ mirror:
+ reflectivity: 1
+- instance:
+ object:
+ material: *mirror
+ cylinder: { height: 1, radius: 1 }
+---
+- material: &mirror
+ mirror:
+ roughness: 0
+- instance:
+ object:
+ material: *mirror
+ cylinder: { height: 1, radius: 1 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1, roughness: 0 } }
+ cylinder: { height: -0.1, radius: 1 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1, roughness: 0 } }
+ cylinder: { height: 1, radius: -0.00001 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1, roughness: 0 } }
+ cylinder: { height: 1, radius: 1, slices: 2 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1, roughness: 0 } }
+ cylinder:
+ radius: 1
+ slices: 4
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1, roughness: 0 } }
+ cylinder:
+ height:
+ radius: 1
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1, roughness: 0 } }
+ cylinder:
+ height: 1
+ radius:
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1, roughness: 0 } }
+ cylinder:
+ height: 1
+ radius: 1
+ slices:
+---
+- instance:
+ object:
+ material: { mirror: }
+ cylinder: { height: 1, radius: 1 }
+---
+- instance:
+ object:
+ material:
+ cylinder: { height: 1, radius: 1 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1, roughness: 0 } }
+ cylinder:
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1, roughness: 0, dummy: "none" } }
+ cylinder: { height: 1, radius: 1 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 1, roughness: 0 } }
+ cylinder: { height: 1, radius: 1, dummy: 3.14 }
+
diff --git a/src/yaml/test_ok_0.yaml b/src/yaml/test_ok_0.yaml
@@ -29,3 +29,21 @@
object:
material: *lambertian
cuboid: { size: [1, 2, 3] }
+
+---
+- material: &front { matte: { reflectivity: 1 } }
+- material: &back { matte: { reflectivity: 0.5 } }
+- object: &cuboid
+ cuboid: { size: [1, 2, 3] }
+ material: { front: *front, back: *back }
+- instance: { object: *cuboid }
+---
+- material: &lambertian { matte: { reflectivity: 1 } }
+- instance:
+ object: &cuboid
+ cuboid: { size: [1, 2, 3] }
+ material:
+ front: *lambertian
+ back: *lambertian
+
+
diff --git a/src/yaml/test_ok_1.yaml b/src/yaml/test_ok_1.yaml
@@ -0,0 +1,47 @@
+- material: &mirror
+ mirror:
+ reflectivity: 1
+ roughness: 0
+
+- object: &cylinder
+ material: *mirror
+ cylinder:
+ height: 1
+ radius: 1
+ slices: 32
+
+- instance:
+ object: *cylinder
+ transform:
+ translation: [0, 1, 2]
+ rotation: [0, 0, 0]
+---
+- material: &mirror
+ mirror:
+ reflectivity: 1
+ roughness: 0
+
+- object: &cylinder
+ material: *mirror
+ cylinder:
+ height: 1
+ radius: 1
+
+- instance:
+ object: *cylinder
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 0.314, roughness: 0.5 } }
+ cylinder: { height: 10.12, radius: 0.32 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 0, roughness: 0.5 } }
+ cylinder: { height: 1, radius: 1 }
+---
+- instance:
+ object:
+ material: { mirror: { reflectivity: 0, roughness: 0.5 } }
+ cylinder: { height: 0, radius: 0 }
+
diff --git a/src/yaml/test_ok_2.yaml b/src/yaml/test_ok_2.yaml
@@ -0,0 +1,22 @@
+- instance:
+ object:
+ material: { matte: { reflectivity: 1 } }
+ obj: { path: "my_path" }
+---
+- instance:
+ object:
+ material: { matte: { reflectivity: 1 } }
+ obj: { path: "path/path/path" }
+ transform: { translation: [1, 2, 3] }
+---
+- instance:
+ object:
+ material: { matte: { reflectivity: 1 } }
+ obj: { path: "path/path/path" }
+ transform: { rotation: [0, 0, 0] }
+---
+- instance:
+ object:
+ material: { matte: { reflectivity: 1 } }
+ stl: { path: "path/path/path" }
+