package de.newsarea.homecockpit.fsuipc.util;

import de.newsarea.homecockpit.fsuipc.domain.OffsetItem;
import org.testng.annotations.Test;

import static org.testng.AssertJUnit.assertEquals;

public class FSUIPCUtilTest {

    @Test
    public void shouldConvertToAlititude() {
        assertEquals(70.3D, FSUIPCUtil.toAlititude(92406982376L), 0);
    }

    @Test
    public void shouldConvertToFSUIPCAlititude() {
        assertEquals(90621753215L, FSUIPCUtil.toFSUIPCAlititude(70.3D));
    }

    @Test
    public void shouldConvertToOffsetItem() {
        OffsetItem oItem = OffsetItem.from("1, 4, 5000");
        assertEquals(1, oItem.getOffset());
        assertEquals(4, oItem.getSize());
        assertEquals(5000, oItem.getValue().toInt());
    }

}

@@ -39,16 +39,74 @@
 .util;%0A%0A
+import de.newsarea.homecockpit.fsuipc.domain.OffsetIdent;%0A
 import d
@@ -154,16 +154,16 @@
 etItem;%0A
-
 import o
@@ -630,16 +630,29 @@
 oItem = 
+FSUIPCUtil.to
 OffsetIt
@@ -657,13 +657,8 @@
 Item
-.from
 (%221,
@@ -751,24 +751,24 @@
 getSize());%0A
-
         asse
@@ -816,10 +816,962 @@
 %0A    %7D%0A%0A
+    @Test%0A    public void shouldConvertToOffsetItems() throws Exception %7B%0A        OffsetItem%5B%5D oItems = FSUIPCUtil.toOffsetItems(%22%5B%5B 1, 4, 5000 %5D, %5B 2, 4, 5000 %5D%5D%22);%0A        assertEquals(2, oItems.length);%0A        assertEquals(%220x00000001 (1) : 4 : 5000 (0x00001388)%22, oItems%5B0%5D.toString());%0A        assertEquals(%220x00000002 (2) : 4 : 5000 (0x00001388)%22, oItems%5B1%5D.toString());%0A    %7D%0A%0A    @Test%0A    public void shouldConvertToOffsetIdent() %7B%0A        OffsetIdent oIdent = FSUIPCUtil.toOffsetIdent(%221, 4%22);%0A        assertEquals(1, oIdent.getOffset());%0A        assertEquals(4, oIdent.getSize());%0A    %7D%0A%0A    @Test%0A    public void shouldConvertToOffsetIdents() throws Exception %7B%0A        OffsetIdent%5B%5D oIdents = FSUIPCUtil.toOffsetIdents(%22%5B%5B 1, 4, 5000 %5D, %5B 2, 4, 5000 %5D%5D%22);%0A        assertEquals(2, oIdents.length);%0A        assertEquals(%220x00000001 (1) : 4%22, oIdents%5B0%5D.toString());%0A        assertEquals(%220x00000002 (2) : 4%22, oIdents%5B1%5D.toString());%0A    %7D%0A%0A
 %7D%0A

add fsuipcUtil tests