/*
 * See LICENSE file in distribution for copyright and licensing information.
 */
package org.yaml.snakeyaml.constructor;

import junit.framework.TestCase;

import org.yaml.snakeyaml.Yaml;

public class SafeConstructorTest extends TestCase {

    public void testConstructFloat() {
        Yaml yaml = new Yaml();
        assertEquals(3.1416, yaml.load("+3.1416"));
        assertEquals(Double.POSITIVE_INFINITY, yaml.load("+.inf"));
        assertEquals(Double.POSITIVE_INFINITY, yaml.load(".inf"));
        assertEquals(Double.NEGATIVE_INFINITY, yaml.load("-.inf"));
    }
}

@@ -152,16 +152,50 @@
 tCase;%0A%0A
+import org.yaml.snakeyaml.Loader;%0A
 import o
@@ -603,11 +603,778 @@
 );%0A    %7D
+%0A%0A    public void testSafeConstruct() %7B%0A        Yaml yaml = new Yaml(new Loader(new SafeConstructor()));%0A        assertEquals(3.1416, yaml.load(%22+3.1416%22));%0A    %7D%0A%0A    public void testSafeConstructJavaBean() %7B%0A        Yaml yaml = new Yaml(new Loader(new SafeConstructor()));%0A        String data = %22--- !!org.yaml.snakeyaml.constructor.Person%5CnfirstName: Andrey%5Cnage: 99%22;%0A        try %7B%0A            yaml.load(data);%0A            fail(%22JavaBeans cannot be created by SafeConstructor.%22);%0A        %7D catch (ConstructorException e) %7B%0A            assertTrue(e%0A                    .getMessage()%0A                    .contains(%0A                            %22could not determine a constructor for the tag tag:yaml.org,2002:org.yaml.snakeyaml.constructor.Person%22));%0A        %7D%0A    %7D
 %0A%7D%0A

add a test to prove that SafeConstructor cannot create custom Java classes