https://en.wikipedia.org/w/index.php?action=history&feed=atom&title=Module%3AFormat_price%2Ftestcases Module:Format price/testcases - Revision history 2025-06-15T02:40:49Z Revision history for this page on the wiki MediaWiki 1.45.0-wmf.5 https://en.wikipedia.org/w/index.php?title=Module:Format_price/testcases&diff=1025755573&oldid=prev GKFX: Update tests 2021-05-29T11:00:54Z <p>Update tests</p> <table style="background-color: #fff; color: #202122;" data-mw="interface"> <col class="diff-marker" /> <col class="diff-content" /> <col class="diff-marker" /> <col class="diff-content" /> <tr class="diff-title" lang="en"> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">← Previous revision</td> <td colspan="2" style="background-color: #fff; color: #202122; text-align: center;">Revision as of 11:00, 29 May 2021</td> </tr><tr> <td colspan="2" class="diff-lineno">Line 16:</td> <td colspan="2" class="diff-lineno">Line 16:</td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||12.78|2}}', '12.78') </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||12.78|2}}', '12.78') </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div> </div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||1234560.78|1}}', '1.23<del style="font-weight: bold; text-decoration: none;"> million</del>') </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||1234560.78|1}}', '1.23<ins style="font-weight: bold; text-decoration: none;">\194\160million</ins>') </div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||12345600.78|2}}', '12.3<del style="font-weight: bold; text-decoration: none;"> million</del>') </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||12345600.78|2}}', '12.3<ins style="font-weight: bold; text-decoration: none;">\194\160million</ins>') </div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||123456000.78|-2}}', '123<del style="font-weight: bold; text-decoration: none;"> million</del>') </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||123456000.78|-2}}', '123<ins style="font-weight: bold; text-decoration: none;">\194\160million</ins>') </div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||1234560000.78|-1}}', '1.23<del style="font-weight: bold; text-decoration: none;"> billion</del>') </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||1234560000.78|-1}}', '1.23<ins style="font-weight: bold; text-decoration: none;">\194\160billion</ins>') </div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||12345600000.78|0}}', '12.3<del style="font-weight: bold; text-decoration: none;"> billion</del>') </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||12345600000.78|0}}', '12.3<ins style="font-weight: bold; text-decoration: none;">\194\160billion</ins>') </div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||123456000000.78|0}}', '123<del style="font-weight: bold; text-decoration: none;"> billion</del>') </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||123456000000.78|0}}', '123<ins style="font-weight: bold; text-decoration: none;">\194\160billion</ins>') </div></td> </tr> <tr> <td class="diff-marker" data-marker="−"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||1234560000000.78|0}}', '1.23<del style="font-weight: bold; text-decoration: none;"> trillion</del>') </div></td> <td class="diff-marker" data-marker="+"></td> <td style="color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> self:preprocess_equals('{{#invoke:Format price||1234560000000.78|0}}', '1.23<ins style="font-weight: bold; text-decoration: none;">\194\160trillion</ins>') </div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>end</div></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><div>end</div></td> </tr> <tr> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> <td class="diff-marker"></td> <td style="background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;"><br /></td> </tr> </table> GKFX https://en.wikipedia.org/w/index.php?title=Module:Format_price/testcases&diff=1025680792&oldid=prev GKFX: tests 2021-05-28T22:43:34Z <p>tests</p> <p><b>New page</b></p><div>-- Unit tests for [[Module:Format price]]. Click talk page to run tests.<br /> local p = require(&#039;Module:UnitTests&#039;)<br /> <br /> -- Example unit test.<br /> function p:test_main()<br /> self:preprocess_equals(&#039;{{#invoke:Format price||123456.78|-2}}&#039;, &#039;123,500&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||123456.78|-1}}&#039;, &#039;123,460&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||123456.78|0}}&#039;, &#039;123,457&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||123456.78|1}}&#039;, &#039;123,457&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||123456.78|2}}&#039;, &#039;123,457&#039;) <br /> <br /> self:preprocess_equals(&#039;{{#invoke:Format price||12.78|-2}}&#039;, &#039;0&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||12.78|-1}}&#039;, &#039;10&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||12.78|0}}&#039;, &#039;13&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||12.78|1}}&#039;, &#039;13&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||12.78|2}}&#039;, &#039;12.78&#039;) <br /> <br /> self:preprocess_equals(&#039;{{#invoke:Format price||1234560.78|1}}&#039;, &#039;1.23 million&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||12345600.78|2}}&#039;, &#039;12.3 million&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||123456000.78|-2}}&#039;, &#039;123 million&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||1234560000.78|-1}}&#039;, &#039;1.23 billion&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||12345600000.78|0}}&#039;, &#039;12.3 billion&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||123456000000.78|0}}&#039;, &#039;123 billion&#039;) <br /> self:preprocess_equals(&#039;{{#invoke:Format price||1234560000000.78|0}}&#039;, &#039;1.23 trillion&#039;) <br /> end<br /> <br /> return p</div> GKFX