"Fossies" - the Fresh Open Source Software Archive

Member "google-gadgets-for-linux-0.11.2/extensions/linux_system_framework/tests/machine_test.cc" (15 Mar 2009, 3019 Bytes) of package /linux/misc/old/google-gadgets-for-linux-0.11.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*
    2   Copyright 2008 Google Inc.
    3 
    4   Licensed under the Apache License, Version 2.0 (the "License");
    5   you may not use this file except in compliance with the License.
    6   You may obtain a copy of the License at
    7 
    8        http://www.apache.org/licenses/LICENSE-2.0
    9 
   10   Unless required by applicable law or agreed to in writing, software
   11   distributed under the License is distributed on an "AS IS" BASIS,
   12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13   See the License for the specific language governing permissions and
   14   limitations under the License.
   15 */
   16 
   17 #include <stdio.h>
   18 #include <ggadget/common.h>
   19 #include <ggadget/logger.h>
   20 #include <ggadget/tests/init_extensions.h>
   21 #include <unittest/gtest.h>
   22 #include "../machine.h"
   23 
   24 using namespace ggadget;
   25 using namespace ggadget::framework;
   26 using namespace ggadget::framework::linux_system;
   27 
   28 TEST(Machine, GetBiosSerialNumber) {
   29   Machine machine;
   30   std::string number = machine.GetBiosSerialNumber();
   31   EXPECT_TRUE(number.size());
   32   LOG("Serial#: %s", number.c_str());
   33 }
   34 
   35 TEST(Machine, GetMachineManufacturer) {
   36   Machine machine;
   37   std::string vendor = machine.GetMachineManufacturer();
   38   EXPECT_TRUE(vendor.size());
   39   LOG("vendor: %s", vendor.c_str());
   40 }
   41 
   42 TEST(Machine, GetMachineModel) {
   43   Machine machine;
   44   std::string model = machine.GetMachineModel();
   45   EXPECT_TRUE(model.size());
   46   LOG("model: %s", model.c_str());
   47 }
   48 
   49 TEST(Machine, GetProcessorArchitecture) {
   50   Machine machine;
   51   std::string arch = machine.GetProcessorArchitecture();
   52   EXPECT_TRUE(arch.size());
   53   LOG("process architecture: %s", arch.c_str());
   54 }
   55 
   56 TEST(Machine, GetProcessorCount) {
   57   Machine machine;
   58   int cpu_count = machine.GetProcessorCount();
   59   EXPECT_GT(cpu_count, 0);
   60   LOG("cpu count: %d", cpu_count);
   61 }
   62 
   63 TEST(Machine, GetProcessorFamily) {
   64   Machine machine;
   65   int family = machine.GetProcessorFamily();
   66   EXPECT_GT(family, 0);
   67   LOG("process family: %d", family);
   68 }
   69 
   70 TEST(Machine, GetProcessorModel) {
   71   Machine machine;
   72   int model = machine.GetProcessorModel();
   73   EXPECT_GT(model, 0);
   74   LOG("process model: %d", model);
   75 }
   76 
   77 TEST(Machine, GetProcessorName) {
   78   Machine machine;
   79   std::string name = machine.GetProcessorName();
   80   EXPECT_TRUE(name.size());
   81   LOG("process name: %s", name.c_str());
   82 }
   83 
   84 TEST(Machine, GetProcessorSpeed) {
   85   Machine machine;
   86   int speed = machine.GetProcessorSpeed();
   87   EXPECT_GT(speed, 0);
   88   LOG("process speed: %d", speed);
   89 }
   90 
   91 TEST(Machine, GetProcessorStepping) {
   92   Machine machine;
   93   int stepping = machine.GetProcessorStepping();
   94   EXPECT_GT(stepping, 0);
   95   LOG("process stepping: %d", stepping);
   96 }
   97 
   98 TEST(Machine, GetProcessorVendor) {
   99   Machine machine;
  100   std::string vendor = machine.GetProcessorVendor();
  101   EXPECT_TRUE(vendor.size());
  102   LOG("process vendor: %s", vendor.c_str());
  103 }
  104 
  105 
  106 
  107 
  108 int main(int argc, char **argv) {
  109   testing::ParseGTestFlags(&argc, argv);
  110 
  111   static const char *kExtensions[] = {
  112     "libxml2_xml_parser/libxml2-xml-parser",
  113   };
  114   INIT_EXTENSIONS(argc, argv, kExtensions);
  115 
  116   return RUN_ALL_TESTS();
  117 }