@@ -0,0 +1,1866 @@
+package cgeo.geocaching.brouter.expressions;%0A%0Aimport cgeo.geocaching.brouter.util.DefaultFilesUtils;%0Aimport cgeo.geocaching.storage.ContentStorage;%0Aimport cgeo.geocaching.storage.PersistableFolder;%0A%0Aimport org.junit.Assert;%0Aimport org.junit.Test;%0A%0Apublic class EncodeDecodeTest %7B%0A%0A    @Test%0A    public void encodeDecodeTest() %7B%0A        // make sure profile files exist%0A        DefaultFilesUtils.checkDefaultFiles();%0A%0A        // create routing context and load profile%0A        final BExpressionMetaData meta = new BExpressionMetaData();%0A        final BExpressionContextWay expctxWay = new BExpressionContextWay(meta);%0A        meta.readMetaData();%0A        final ContentStorage.FileInformation fi = ContentStorage.get().getFileInfo(PersistableFolder.ROUTING_BASE.getFolder(), %22trekking.brf%22);%0A        expctxWay.parseFile(fi.uri, %22global%22);%0A%0A        final String%5B%5D tags = %7B %22highway=residential%22,  %22oneway=yes%22,  %22reversedirection=yes%22 %7D;%0A%0A        // encode the tags into 64 bit description word%0A        final int%5B%5D lookupData = expctxWay.createNewLookupData();%0A        for (String arg : tags) %7B%0A            final int idx = arg.indexOf('=');%0A            if (idx %3C 0) %7B%0A                throw new IllegalArgumentException(%22bad argument (should be %3Ctag%3E=%3Cvalue%3E): %22 + arg);%0A            %7D%0A            final String key = arg.substring(0, idx);%0A            final String value = arg.substring(idx + 1);%0A%0A            expctxWay.addLookupValue(key, value, lookupData);%0A        %7D%0A        final byte%5B%5D description = expctxWay.encode(lookupData);%0A%0A        // calculate the cost factor from that description%0A        expctxWay.evaluate(true, description); // true = %22reversedirection=yes%22  (not encoded in description anymore)%0A%0A        final float costfactor = expctxWay.getCostfactor();%0A        Assert.assertTrue(%22costfactor mismatch%22, Math.abs(costfactor - 5.15) %3C 0.00001);%0A    %7D%0A%7D%0A

Migrate last missing brouter test (fix #10279)