~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to unittests/date_test.cc

created or modified all to_int**_t and from_int**_t function tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
332
332
  ASSERT_FALSE(result);
333
333
}
334
334
 
335
 
TEST_F(DateTest, from_int32_t_onValueCreatedBy_to_int32_t_shouldProduceOriginalDate)
336
 
{
337
 
  uint32_t years= 2030, months= 8, days= 17;
338
 
  Generator::DateGen::make_date(&date, years, months, days);
339
 
  uint32_t decoded_years, decoded_months, decoded_days;
 
335
TEST_F(DateTest, to_int64_t)
 
336
{
 
337
  Generator::DateGen::make_date(&date, 2030, 8, 17);
 
338
  int64_t representation;
 
339
  
 
340
  date.to_int64_t(&representation);
 
341
  
 
342
  ASSERT_EQ(20300817, representation);
 
343
}
 
344
 
 
345
TEST_F(DateTest, to_int32_t)
 
346
{
 
347
  Generator::DateGen::make_date(&date, 2030, 8, 17);
340
348
  int32_t representation;
341
 
  Date decoded_date;
342
 
  
 
349
 
343
350
  date.to_int32_t(&representation);
344
 
  decoded_date.from_int32_t(representation);
345
 
  
346
 
  decoded_years= decoded_date.years();
347
 
  decoded_months= decoded_date.months();
348
 
  decoded_days= decoded_date.days();
349
 
  
350
 
  EXPECT_EQ(years, decoded_years);
351
 
  EXPECT_EQ(months, decoded_months);
352
 
  EXPECT_EQ(days, decoded_days);
 
351
 
 
352
  ASSERT_EQ(20300817, representation);
 
353
}
 
354
 
 
355
TEST_F(DateTest, from_int32_t_shouldPopulateDateCorrectly)
 
356
{
 
357
  uint32_t decoded_years, decoded_months, decoded_days;
 
358
 
 
359
  date.from_int32_t(20300817);
 
360
  
 
361
  decoded_years= date.years();
 
362
  decoded_months= date.months();
 
363
  decoded_days= date.days();
 
364
  
 
365
  EXPECT_EQ(2030, decoded_years);
 
366
  EXPECT_EQ(8, decoded_months);
 
367
  EXPECT_EQ(17, decoded_days);
353
368
}
354
369
 
355
370
TEST_F(DateTest, to_julian_day_number)