Skip to content

Commit

Permalink
add VOLUME.teaspoonsUs (#49)
Browse files Browse the repository at this point in the history
* add VOLUME.teaspoonsUs

* Add getter test for new volume teaspoon

---------

Co-authored-by: Vasile Baluta <vasilebaluta@Vasiles-Mac-mini.local>
  • Loading branch information
vasba and Vasile Baluta authored Jul 13, 2024
1 parent d1693a3 commit 7a7b4b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/properties/volume.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum VOLUME {
usPints,
milliliters,
tablespoonsUs,
teaspoonsUs,
australianTablespoons,
cups,
cubicCentimeters,
Expand Down Expand Up @@ -57,6 +58,7 @@ class Volume extends DoubleProperty<VOLUME> {
VOLUME.usPints: 'US pt',
VOLUME.milliliters: 'ml',
VOLUME.tablespoonsUs: 'tbsp.',
VOLUME.teaspoonsUs: 'tsp.',
VOLUME.australianTablespoons: 'tbsp.',
VOLUME.cups: 'cup',
VOLUME.cubicCentimeters: 'cm³',
Expand Down Expand Up @@ -134,6 +136,10 @@ class Volume extends DoubleProperty<VOLUME> {
coefficientProduct: 14.8,
name: VOLUME.tablespoonsUs,
),
ConversionNode(
coefficientProduct: 4.92892,
name: VOLUME.teaspoonsUs,
),
ConversionNode(
coefficientProduct: 20.0,
name: VOLUME.australianTablespoons,
Expand Down Expand Up @@ -198,6 +204,7 @@ class Volume extends DoubleProperty<VOLUME> {
Unit get usPints => getUnit(VOLUME.usPints);
Unit get milliliters => getUnit(VOLUME.milliliters);
Unit get tablespoonsUs => getUnit(VOLUME.tablespoonsUs);
Unit get teaspoonsUs => getUnit(VOLUME.teaspoonsUs);
Unit get australianTablespoons => getUnit(VOLUME.australianTablespoons);
Unit get cups => getUnit(VOLUME.cups);
Unit get cubicCentimeters => getUnit(VOLUME.cubicCentimeters);
Expand Down
1 change: 1 addition & 0 deletions test/conversion_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ void main() {
VOLUME.usPints: 2113.3764188652,
VOLUME.milliliters: 1e6,
VOLUME.tablespoonsUs: 67567.567567568,
VOLUME.teaspoonsUs: 202884.20181297325,
VOLUME.australianTablespoons: 50000,
VOLUME.cups: 4166.6666666667,
VOLUME.cubicCentimeters: 1e6,
Expand Down
1 change: 1 addition & 0 deletions test/getters_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ void main() {
runGetterTest(property.milliliters, property.getUnit(VOLUME.milliliters));
runGetterTest(
property.tablespoonsUs, property.getUnit(VOLUME.tablespoonsUs));
runGetterTest(property.teaspoonsUs, property.getUnit(VOLUME.teaspoonsUs));
runGetterTest(property.australianTablespoons,
property.getUnit(VOLUME.australianTablespoons));
runGetterTest(property.cups, property.getUnit(VOLUME.cups));
Expand Down

0 comments on commit 7a7b4b2

Please sign in to comment.