package de.dfki.asr.compass.math;

import org.testng.annotations.Test;
import static org.testng.Assert.*;

public class DOMStringTest {
	@Test
	public void shouldConvertUnitVector() {
		Vector3f vector = new Vector3f(0, 1, 0);
		assertEquals(vector.toDOMString(), "0.0 1.0 0.0");
	}

	@Test
	public void shouldMaintainOrder() {
		Vector3f vector = new Vector3f(1.0f, 2.0f, 3.0f);
		assertEquals(vector.toDOMString(), "1.0 2.0 3.0");
	}

	@Test
	public void shouldParseZeroVector() {
		Vector3f vector = Vector3f.fromDOMString("0.0 0.0 0.0");
		assertEquals(vector.x, 0.0f);
		assertEquals(vector.y, 0.0f);
		assertEquals(vector.z, 0.0f);
	}

	@Test(expectedExceptions = {NumberFormatException.class})
	public void shouldThrowOnTooFewEntries() {
		Vector3f vector = Vector3f.fromDOMString("0.0 0.0");
	}
}

@@ -720,16 +720,21 @@
 dThrowOn
+Parse
 TooFewEn
@@ -800,11 +800,361 @@
 .0%22);%0A%09%7D
+%0A%0A%09@Test(expectedExceptions = %7BNumberFormatException.class%7D)%0A%09public void shouldThrowOnParseTooManyEntries() %7B%0A%09%09Vector3f vector = Vector3f.fromDOMString(%220.0 0.0 0.0 0.0%22);%0A%09%7D%0A%0A%09@Test(expectedExceptions = %7BNumberFormatException.class%7D)%0A%09public void shouldThrowOnParseNonNumberEntries() %7B%0A%09%09Vector3f vector = Vector3f.fromDOMString(%22foo bar baz%22);%0A%09%7D
 %0A%7D%0A

Improve fromDOMString() testing further