test/hotspot/gtest/utilities/test_globalDefinitions.cpp
changeset 53386 d5f6540c6bb1
parent 53375 ae4295a6a01e
child 57875 427b38332f20
equal deleted inserted replaced
53385:e8ed617dc2bc 53386:d5f6540c6bb1
    91         << "Expect that address below page returns start of page";
    91         << "Expect that address below page returns start of page";
    92     }
    92     }
    93   }
    93   }
    94 }
    94 }
    95 
    95 
       
    96 TEST(globalDefinitions, proper_unit) {
       
    97   EXPECT_EQ(0u,     byte_size_in_proper_unit(0u));
       
    98   EXPECT_STREQ("B", proper_unit_for_byte_size(0u));
       
    99 
       
   100   EXPECT_EQ(1u,     byte_size_in_proper_unit(1u));
       
   101   EXPECT_STREQ("B", proper_unit_for_byte_size(1u));
       
   102 
       
   103   EXPECT_EQ(1023u,  byte_size_in_proper_unit(K - 1));
       
   104   EXPECT_STREQ("B", proper_unit_for_byte_size(K - 1));
       
   105 
       
   106   EXPECT_EQ(1024u,  byte_size_in_proper_unit(K));
       
   107   EXPECT_STREQ("B", proper_unit_for_byte_size(K));
       
   108 
       
   109   EXPECT_EQ(1025u,  byte_size_in_proper_unit(K + 1));
       
   110   EXPECT_STREQ("B", proper_unit_for_byte_size(K + 1));
       
   111 
       
   112   EXPECT_EQ(51200u, byte_size_in_proper_unit(50*K));
       
   113   EXPECT_STREQ("B", proper_unit_for_byte_size(50*K));
       
   114 
       
   115   EXPECT_EQ(1023u,  byte_size_in_proper_unit(M - 1));
       
   116   EXPECT_STREQ("K", proper_unit_for_byte_size(M - 1));
       
   117 
       
   118   EXPECT_EQ(1024u,  byte_size_in_proper_unit(M));
       
   119   EXPECT_STREQ("K", proper_unit_for_byte_size(M));
       
   120 
       
   121   EXPECT_EQ(1024u,  byte_size_in_proper_unit(M + 1));
       
   122   EXPECT_STREQ("K", proper_unit_for_byte_size(M + 1));
       
   123 
       
   124   EXPECT_EQ(1025u,  byte_size_in_proper_unit(M + K));
       
   125   EXPECT_STREQ("K", proper_unit_for_byte_size(M + K));
       
   126 
       
   127   EXPECT_EQ(51200u, byte_size_in_proper_unit(50*M));
       
   128   EXPECT_STREQ("K", proper_unit_for_byte_size(50*M));
       
   129 
       
   130 #ifdef _LP64
       
   131   EXPECT_EQ(1023u,  byte_size_in_proper_unit(G - 1));
       
   132   EXPECT_STREQ("M", proper_unit_for_byte_size(G - 1));
       
   133 
       
   134   EXPECT_EQ(1024u,  byte_size_in_proper_unit(G));
       
   135   EXPECT_STREQ("M", proper_unit_for_byte_size(G));
       
   136 
       
   137   EXPECT_EQ(1024u,  byte_size_in_proper_unit(G + 1));
       
   138   EXPECT_STREQ("M", proper_unit_for_byte_size(G + 1));
       
   139 
       
   140   EXPECT_EQ(1024u,  byte_size_in_proper_unit(G + K));
       
   141   EXPECT_STREQ("M", proper_unit_for_byte_size(G + K));
       
   142 
       
   143   EXPECT_EQ(1025u,  byte_size_in_proper_unit(G + M));
       
   144   EXPECT_STREQ("M", proper_unit_for_byte_size(G + M));
       
   145 
       
   146   EXPECT_EQ(51200u, byte_size_in_proper_unit(50*G));
       
   147   EXPECT_STREQ("M", proper_unit_for_byte_size(50*G));
       
   148 #endif
       
   149 }
       
   150 
    96 TEST(globalDefinitions, exact_unit_for_byte_size) {
   151 TEST(globalDefinitions, exact_unit_for_byte_size) {
    97   EXPECT_STREQ("B", exact_unit_for_byte_size(0));
   152   EXPECT_STREQ("B", exact_unit_for_byte_size(0));
    98   EXPECT_STREQ("B", exact_unit_for_byte_size(1));
   153   EXPECT_STREQ("B", exact_unit_for_byte_size(1));
    99   EXPECT_STREQ("B", exact_unit_for_byte_size(K - 1));
   154   EXPECT_STREQ("B", exact_unit_for_byte_size(K - 1));
   100   EXPECT_STREQ("K", exact_unit_for_byte_size(K));
   155   EXPECT_STREQ("K", exact_unit_for_byte_size(K));