You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "caicancai (via GitHub)" <gi...@apache.org> on 2023/12/26 14:43:13 UTC
[PR] [MINOR] Add FormatElementEnumTests [calcite]
caicancai opened a new pull request, #3599:
URL: https://github.com/apache/calcite/pull/3599
(no comment)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MINOR] Add FormatElementEnumTests [calcite]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai commented on code in PR #3599:
URL: https://github.com/apache/calcite/pull/3599#discussion_r1436490132
##########
core/src/test/java/org/apache/calcite/util/format/FormatElementEnumTest.java:
##########
@@ -33,4 +33,148 @@ class FormatElementEnumTest {
FormatElementEnum.DAY.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
assertThat(ts, hasToString("Tuesday"));
}
+
+ @Test void TestD(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.D.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("3"));
+ }
+
+ @Test void TestDD(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.DD.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("30"));
+ }
+
+ @Test void TestDDD(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.DDD.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("273"));
+ }
+
+ @Test void TestDY(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.DY.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("Tue"));
+ }
+
+ @Test void TestFF1(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.FF1.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("0"));
+ }
+
+ @Test void TestFF2(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.FF2.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("00"));
+ }
+
+ @Test void TestFF3(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.FF3.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("000"));
+ }
+
+ @Test void TestFF4(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.FF4.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("0000"));
+ }
+
+ @Test void TestFF5(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.FF5.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("00000"));
+ }
+
+ @Test void TestFF6(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.FF6.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("000000"));
+ }
+
+ @Test void TestHH12(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.HH12.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("06"));
+ }
+
+ @Test void TestHH24(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.HH24.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("18"));
+ }
+
+ @Test void TestIW(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.IW.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("40"));
+ }
+
+ @Test void TestM1(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.MI.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("00"));
+ }
+
+ @Test void TestMM(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.MM.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("09"));
+ }
+
+ @Test void TestMON(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.MON.format(ts, Date.from(Instant.parse("2014-09-30T10:00:00Z")));
+ assertThat(ts, hasToString("Sep"));
+ }
+
+ @Test void TestMONTH(){
+ StringBuilder ts = new StringBuilder();
+ FormatElementEnum.MONTH.format(ts, Date.from(Instant.parse("2014-06-30T10:00:00Z")));
+ assertThat(ts, hasToString("Sep"));
Review Comment:
This seems to be a bug, the full month name is not displayed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [MINOR] Add FormatElementEnumTests [calcite]
Posted by "caicancai (via GitHub)" <gi...@apache.org>.
caicancai closed pull request #3599: [MINOR] Add FormatElementEnumTests
URL: https://github.com/apache/calcite/pull/3599
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org