Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add AU (distance) conversion #118

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public class Unit {
public static final int NAUTICAL_MILE = 410;
public static final int FURLONG = 411;
public static final int LIGHT_YEAR = 412;
public static final int ASTRONOMICAL_UNIT = 413;

public static final int KILOGRAM = 500;
public static final int POUND = 501;
Expand Down Expand Up @@ -195,7 +196,7 @@ public class Unit {
BIT, BYTE, KILOBIT, KILOBYTE, MEGABIT, MEGABYTE, GIGABIT, GIGABYTE, TERABIT, TERABYTE,
JOULE, KILOJOULE, CALORIE, KILOCALORIE, BTU, FT_LBF, IN_LBF, KILOWATT_HOUR, ELECTRON_VOLT,
MPG_US, MPG_UK, L_100K, KM_L, MILES_L,
KILOMETRE, MILE, METRE, CENTIMETRE, MILLIMETRE, MICROMETRE, NANOMETRE, YARD, FEET, INCH, NAUTICAL_MILE, FURLONG, LIGHT_YEAR,
KILOMETRE, MILE, METRE, CENTIMETRE, MILLIMETRE, MICROMETRE, NANOMETRE, YARD, FEET, INCH, NAUTICAL_MILE, FURLONG, ASTRONOMICAL_UNIT, LIGHT_YEAR,
KILOGRAM, POUND, GRAM, MILLIGRAM, OUNCE, GRAIN, STONE, METRIC_TON, SHORT_TON, LONG_TON,
WATT, KILOWATT, MEGAWATT, HP, HP_UK, FT_LBF_S, CALORIE_S, BTU_S, KVA,
MEGAPASCAL, KILOPASCAL, PASCAL, BAR, PSI, PSF, ATMOSPHERE, TECHNICAL_ATMOSPHERE, MMHG, TORR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ private void getLengthConversions() {
units.add(new Unit(INCH, R.string.inch, 0.0254, 39.3700787401574803));
units.add(new Unit(NAUTICAL_MILE, R.string.nautical_mile, 1852.0, 0.000539956803455723542));
units.add(new Unit(FURLONG, R.string.furlong, 201.168, 0.0049709695379));
units.add(new Unit(ASTRONOMICAL_UNIT, R.string.astronomical_unit, 149597870700.0, 0.0000000000066845871222684454959959533));
units.add(new Unit(LIGHT_YEAR, R.string.light_year, 9460730472580800.0, 0.0000000000000001057000834024615463709));
addConversion(Conversion.LENGTH, new Conversion(Conversion.LENGTH, R.string.length, units));
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<string name="inch">Zoll (in)</string>
<string name="nautical_mile">Seemeile</string>
<string name="furlong">Furlong</string>
<string name="astronomical_unit">Astronomische Einheit</string>
<string name="light_year">Lichtjahr</string>

<!-- Mass/Weight -->
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<string name="inch">Pulgada</string>
<string name="nautical_mile">Milla Náutica</string>
<string name="furlong">Furlong</string>
<string name="astronomical_unit">Unidad astronómica</string>
<string name="light_year">Año Luz</string>

<!-- Mass/Weight -->
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-fa/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<string name="inch">اینچ</string>
<string name="nautical_mile">مایل دریایی</string>
<string name="furlong">فرلانگ</string>
<string name="astronomical_unit">وحدة فلكية</string>
<string name="light_year">سال نوری</string>

<!-- جرم / وزن -->
Expand Down Expand Up @@ -269,4 +270,4 @@
<string name="usd">دلار آمریکا</string>
<string name="zar">رند آفریقای جنوبی</string>

</resources>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-fr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
<string name="inch">Pouce</string>
<string name="nautical_mile">Mille marin</string>
<string name="furlong">Stade</string>
<string name="astronomical_unit">Unité astronomique</string>
<string name="light_year">Année lumière</string>

<!-- Mass/Weight -->
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-hr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<string name="inch">Inč</string>
<string name="nautical_mile">Nautička Milja</string>
<string name="furlong">Osmina milje</string>
<string name="astronomical_unit">Astronomska jedinica</string>
<string name="light_year">Svijetlosna Godina</string>

<!-- Mass/Weight -->
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
<string name="inch">Hüvelyk</string>
<string name="nautical_mile">Tengeri Mérföld</string>
<string name="furlong">Furlong</string>
<string name="astronomical_unit">Csillagászati egység</string>
<string name="light_year">Fényév</string>

<!-- Mass/Weight -->
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<string name="inch">Pollice</string>
<string name="nautical_mile">Miglio Nautico</string>
<string name="furlong">Furlong</string>
<string name="astronomical_unit">Unità astronomica</string>
<string name="light_year">Anno Luce</string>

<!-- Mass/Weight -->
Expand Down Expand Up @@ -269,4 +270,4 @@
<string name="usd">Dollaro Americano</string>
<string name="zar">Rand Sudafricano</string>

</resources>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values-ja/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<string name="inch">インチ</string>
<string name="nautical_mile">海里</string>
<string name="furlong">ハロン</string>
<string name="astronomical_unit">天文単位</string>
<string name="light_year">光年</string>

<!-- Mass/Weight -->
Expand Down Expand Up @@ -269,4 +270,4 @@
<string name="usd">米ドル</string>
<string name="zar">南アフリカ・ランド</string>

</resources>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values-pt-rBR/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<string name="inch">Polegada</string>
<string name="nautical_mile">Milha náutica</string>
<string name="furlong">Furlong</string>
<string name="astronomical_unit">Unidade astronômica</string>
<string name="light_year">Ano-Luz</string>

<!-- Massa/Peso -->
Expand Down Expand Up @@ -271,4 +272,4 @@
<string name="prefs_summary_language">Escolha o idioma a ser usado em todo o aplicativo</string>
<string name="prefs_title_language">Idioma</string>

</resources>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values-ru/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<string name="inch">Дюйм</string>
<string name="nautical_mile">Морская миля</string>
<string name="furlong">Фурлонг</string>
<string name="astronomical_unit">Астрономическая единица</string>
<string name="light_year">Световой год</string>

<!-- Mass/Weight -->
Expand Down Expand Up @@ -269,4 +270,4 @@
<string name="usd">Доллар США</string>
<string name="zar">Южноафриканский рэнд</string>

</resources>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values-tr/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
<string name="inch">İnç</string>
<string name="nautical_mile">Deniz Mili</string>
<string name="furlong">Furlong</string>
<string name="astronomical_unit">Astronomik birim</string>
<string name="light_year">Işık Yılı</string>

<!-- Mass/Weight -->
Expand Down Expand Up @@ -269,4 +270,4 @@
<string name="usd">Amerikan Doları</string>
<string name="zar">Güney Afrika Randı</string>

</resources>
</resources>
3 changes: 2 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@
<string name="inch">Inch</string>
<string name="nautical_mile">Nautical Mile</string>
<string name="furlong">Furlong</string>
<string name="astronomical_unit">Astronimical Unit</string>
<string name="light_year">Light Year</string>

<!-- Mass/Weight -->
Expand Down Expand Up @@ -293,4 +294,4 @@
<string name="isk">Icelandic Krona</string>
<string name="language_norwegian">Norwegian</string>

</resources>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ public void testLength()
verify(view).showResult(AdditionalMatchers.eq(0.0000026251, DELTA_10));
mPresenter.convert(5.5, length.getUnitById(LIGHT_YEAR), length.getUnitById(KILOMETRE));
verify(view).showResult(eq(52034017599194.4));
mPresenter.convert(5.5, length.getUnitById(MILE), length.getUnitById(ASTRONOMICAL_UNIT));
verify(view).showResult(eq(5.91679009773499403156946130719936E-8));
mPresenter.convert(5.5, length.getUnitById(ASTRONOMICAL_UNIT), length.getUnitById(FURLONG));
verify(view).showResult(eq(4090055520.014216222415));
}

@Test
Expand Down Expand Up @@ -396,4 +400,4 @@ public void testVolume()
mPresenter.convert(5.5, volume.getUnitById(CUBIC_YARD), volume.getUnitById(TEASPOON));
verify(view, atLeastOnce()).showResult(AdditionalMatchers.eq(853138.298312504, DELTA_9));
}
}
}