TEST_F(FunctionTypeTests,
TwoFunctionTypesDifferingInVarArgAreNotEqual) {
	ShPtr<FunctionType> ft1(FunctionType::create());

	ShPtr<FunctionType> ft2(FunctionType::create());
	ft2->setVarArg();

	EXPECT_FALSE(ft1->isEqualTo(ft2));
}
TEST_F(FunctionTypeTests,
TwoFunctionTypesDifferingInNumberOfParametersAreNotEqual) {
	ShPtr<FunctionType> ft1(FunctionType::create());

	ShPtr<FunctionType> ft2(FunctionType::create());
	ShPtr<IntType> paramType(IntType::create(32));
	ft2->addParam(paramType);

	EXPECT_FALSE(ft1->isEqualTo(ft2));
}
TEST_F(FunctionTypeTests,
TwoFunctionTypesDifferingInReturnTypeAreNotEqual) {
	ShPtr<VoidType> f1RetType(VoidType::create());
	ShPtr<FunctionType> ft1(FunctionType::create(f1RetType));

	ShPtr<IntType> f2RetType(IntType::create(32));
	ShPtr<FunctionType> ft2(FunctionType::create(f2RetType));

	EXPECT_FALSE(ft1->isEqualTo(ft2));
}
TEST_F(FunctionTypeTests,
CloningCreatesEqualFunctionType) {
	ShPtr<IntType> retType(IntType::create(16));
	ShPtr<IntType> param1Type(IntType::create(32));
	ShPtr<IntType> param2Type(IntType::create(64));
	ShPtr<FunctionType> ft1(FunctionType::create(retType));
	ft1->addParam(param1Type);
	ft1->addParam(param2Type);
	ft1->setVarArg();

	ShPtr<FunctionType> ft2(ucast<FunctionType>(ft1->clone()));

	EXPECT_TRUE(ft1->isEqualTo(ft2));
}
TEST_F(FunctionTypeTests,
TwoFunctionTypesWithSameDataAreEqual) {
	ShPtr<IntType> retType(IntType::create(16));
	ShPtr<IntType> param1Type(IntType::create(32));
	ShPtr<IntType> param2Type(IntType::create(64));

	ShPtr<FunctionType> ft1(FunctionType::create(retType));
	ft1->addParam(param1Type);
	ft1->addParam(param2Type);
	ft1->setVarArg();

	ShPtr<FunctionType> ft2(FunctionType::create(retType));
	ft2->addParam(param1Type);
	ft2->addParam(param2Type);
	ft2->setVarArg();

	EXPECT_TRUE(ft1->isEqualTo(ft2));
}
Beispiel #6
0
int		main()
{
	FragTrap	ft("#YOLO");
	FragTrap	ft2(ft);
	FragTrap	ft3 = ft2;

	ft.rangedAttack("other");
	ft.meleeAttack("other");
	ft.takeDamage(32);
	ft2.takeDamage(150);
	ft3.takeDamage(0);
	ft3.beRepaired(0);
	ft3.beRepaired(150);
	ft.vaulthunter_dot_exe("other");
	ft.vaulthunter_dot_exe("other");
	ft.vaulthunter_dot_exe("other");
	ft.vaulthunter_dot_exe("other");
	ft.vaulthunter_dot_exe("other");
	ft.vaulthunter_dot_exe("other");
}
int main(void){
    pa0();
    vezerlo_valtozo=1;
    korabbi_dontesek_szama=0;
    while(vezerlo_valtozo)
        switch(vezerlo_valtozo){
            case 1: if (ft1()){
                        pa8();
                        vezerlo_valtozo=0;
                      }
                      else if (ft2()) if ((valasztasi_lehetosegek_szama=fa1())){
                                          pa2();
                                          aktualis_lehetoseg_sorszama=0;
                                          vezerlo_valtozo=3;
                                         }
                                         else vezerlo_valtozo=2;
                              else vezerlo_valtozo=2;
                    break;
            case 2: if (korabbi_dontesek_szama){
                        korabbi_dontesek_szama--;
                        pa4();
                        if (aktualis_lehetoseg_sorszama<valasztasi_lehetosegek_szama-1){
                            aktualis_lehetoseg_sorszama++;
                            vezerlo_valtozo=3;
                           }
                           else vezerlo_valtozo=2;
                       }
                       else {
                           printf("A graf nem szinezheto %d szinnel!\n",MAX_color);
                           vezerlo_valtozo=0;
                       }
                    break;
            case 3: pa6();
                    pa7();
                    korabbi_dontesek_szama++;
                    vezerlo_valtozo=1;
        }
		getchar();
    return 0;

}
Beispiel #8
0
int		main()
{
	FragTrap	ft("#YOLO");
	FragTrap	ft2(ft);
	FragTrap	ft3 = ft2;

	ScavTrap	st("#YOLO");
	ScavTrap	st2(st);
	ScavTrap	st3 = st2;

	ft.rangedAttack("other");
	ft.meleeAttack("other");
	ft.takeDamage(32);
	ft2.takeDamage(150);
	ft3.takeDamage(0);
	ft3.beRepaired(0);
	ft3.beRepaired(150);
	ft.vaulthunter_dot_exe("other");
	ft.vaulthunter_dot_exe("other");
	ft.vaulthunter_dot_exe("other");
	ft.vaulthunter_dot_exe("other");
	ft.vaulthunter_dot_exe("other");
	ft.vaulthunter_dot_exe("other");
	
	st.rangedAttack("other");
	st.meleeAttack("other");
	st.takeDamage(32);
	st2.takeDamage(150);
	st3.takeDamage(0);
	st3.beRepaired(0);
	st3.beRepaired(150);
	st.challengeNewcomer("other");
	st.challengeNewcomer("other");
	st.challengeNewcomer("other");
	st.challengeNewcomer("other");
	st.challengeNewcomer("other");
	st.challengeNewcomer("other");
}
int main(int argc, char* argv[])
{
  if (argc > 2)
  {
    std::cout << "usage:\n";
    std::cout << "./count [<file>]\n\n";
    std::cout << "  file           Path to the input file containing the tweets\n";
    return 1;
  }

  std::cout << "executing " << argv[0] << std::endl;

  std::string directory;
  const size_t last_slash_idx = std::string(argv[0]).rfind('/');
  if (std::string::npos != last_slash_idx)
  {
    directory = std::string(argv[0]).substr(0, last_slash_idx);
  }

  std::string tweets;  

  if (argc == 2) 
    tweets = std::string(argv[1]);
  else
    tweets = directory + "/../tweet_input/tweets.txt";

  int max_string_size = 0;
  std::map<std::string, int> table;
  std::string aa = directory + "/../tweet_output/ft1.txt";
  std::string bb = directory + "/../tweet_output/ft2.txt"; 
  std::ofstream wc_result(aa.c_str());
  std::ofstream ft2(bb.c_str());
  std::ifstream file;

  file.open(tweets.c_str());
  if (!file.is_open())
  { 
    std::cerr << "ERROR: file not found "  << tweets << std::endl;
    throw;
  }
  if (!wc_result.is_open())
  {
    std::cerr << "ERROR: can not create ouput file" << std::endl;
    throw;
  };

  std::vector<int> words_per_line;
  std::string line;
  while (std::getline(file, line))
  {
    std::set<std::string> line_words;

    //std::cout << line << std::endl;
    std::istringstream is(line);
    std::string word;
    while (is >> word)
    {
      line_words.insert(word);
      if (max_string_size < word.size())
        max_string_size = word.size();
      std::map<std::string, int>::iterator here = table.find(word);
      if (here == table.end())
        table.insert(std::make_pair(word, 1));
      else
       (*here).second ++;
    }
    insert_sort(words_per_line, line_words.size());
    ft2 << std::fixed << std::setprecision(1) << median(words_per_line) << std::endl;
    //ft2 << median(words_per_line) << std::endl;
  }

  file.close();

  std::map<std::string, int>::iterator it = table.begin();

  for ( ; it != table.end(); ++it)
  {
    wc_result << std::left << std::setw(max_string_size) << std::setfill(' ')        << (*it).first;
    wc_result << " " << (*it).second << std::endl;
  }

  wc_result.close();

}
Beispiel #10
0
int		main(void)
{
	FragTrap ft1("Alf");
	FragTrap ft2("Bob");
	FragTrap ft3(ft1);
	std::cout << std::endl;


	ft3 = ft2;
	std::cout << std::endl;

	ft1.rangedAttack("Bob");
	std::cout << std::endl;

	ft1.meleeAttack("Bob");
	std::cout << std::endl;

	ft1.takeDamage(3);
	std::cout << std::endl;

	ft1.beRepaired(3);
	std::cout << std::endl;

	ft1.takeDamage(1000);
	std::cout << std::endl;

	ft1.beRepaired(1000);
	std::cout << std::endl;

	ft1.beRepaired(3);
	std::cout << std::endl;

	ft1.Ep = 100;
	std::cout << std::endl;

	ft1.vaulthunter_dot_exe("1");
	ft1.vaulthunter_dot_exe("2");
	ft1.vaulthunter_dot_exe("3");
	ft1.vaulthunter_dot_exe("4");
	ft1.vaulthunter_dot_exe("5");
	std::cout << std::endl;

	ScavTrap st1("John");
    ScavTrap st2("Ben");
    ScavTrap st3;
	std::cout << std::endl;

    st1.meleeAttack("bob");
    st1.rangedAttack("Alf");
	std::cout << std::endl;

    st2.takeDamage(45);
    st2.beRepaired(21);
	std::cout << std::endl;

    st3.challengeNewcomer();
    st3.challengeNewcomer();
	std::cout << std::endl;

	return (0);
}
Beispiel #11
0
int		main(void)
{
	FragTrap ft1("Alf");
	FragTrap ft2("Bob");
	FragTrap ft3(ft1);
	std::cout << std::endl;


	ft1.debug();
	ft2.debug();
	ft3.debug();
	std::cout << std::endl;

	ft3 = ft2;
	ft1.debug();
	ft2.debug();
	ft3.debug();
	std::cout << std::endl;

	ft1.rangedAttack("Bob");
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.meleeAttack("Bob");
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.takeDamage(3);
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.beRepaired(3);
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.takeDamage(1000);
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.beRepaired(1000);
	ft1.debug();
	ft2.debug();
	std::cout << std::endl;

	ft1.vaulthunter_dot_exe("1");
	ft1.debug();
	ft1.vaulthunter_dot_exe("2");
	ft1.debug();
	ft1.vaulthunter_dot_exe("3");
	ft1.debug();
	ft1.vaulthunter_dot_exe("4");
	ft1.debug();
	ft1.vaulthunter_dot_exe("5");
	ft1.debug();
	std::cout << std::endl;

	return (0);
}
Beispiel #12
0
// Main
int main(int argc, char *argv[])
{
    // Init GTK
    Gtk::Main kit(argc, argv);
    Gtk::Window window;
    window.set_size_request(450, 350);

        Gtk::Fixed fixed;
        window.add(fixed);

            // Lines ////////

            Lines lines;
            lines.set_size_request(500, 425);

            // FLTK
            lines.add_line(230, 45, 110, 115);
            lines.add_line(270, 45, 270, 90);
            lines.add_line(290, 45, 400, 165);
            lines.add_line(310, 40, 350, 60);

            // Point
            lines.add_line(110, 55, 110, 115);
            lines.add_line(150, 55, 210, 90);

            // Graph
            lines.add_line(110, 160, 90, 240);
            lines.add_line(110, 160, 170, 340);

            // Window
            lines.add_line(250, 135, 230, 190);
            lines.add_line(270, 135, 270, 265);
            lines.add_line(320, 135, 400, 165);

            // GUI
            lines.add_line(340, 210, 270, 265);
            lines.add_line(390, 210, 400, 240);

            // Simple
            lines.add_line(200, 310, 170, 340);

            // So difficult... >.<

            fixed.add(lines);

            // Nodes ////////

            TitledText tt1("Point.h", "struct Point { ... };");
            fixed.put(tt1, 50, 25);

            TitledText tt2("Graph.h", "// graphing interface\nstruct Shape { ... };\n...");
            fixed.put(tt2, 50, 100);

            TitledText tt3("Graph.cpp", "Graph code");
            fixed.put(tt3, 25, 225);

            TitledText tt4("Window.h", "// window interface\nclass Window { ... };\n...");
            fixed.put(tt4, 200, 75);

            TitledText tt5("Window.cpp", "Window code");
            fixed.put(tt5, 150, 175);

            TitledText tt6("GUI.h", "// GUI interface\nstruct In_box { ... };\n...");
            fixed.put(tt6, 325, 150);

            TitledText tt7("GUI.cpp", "GUI code");
            fixed.put(tt7, 350, 225);

            TitledText tt8("Simple_window.h", "// window interface\nclass Simple_window { ... };\n...");
            fixed.put(tt8, 175, 250);

            TitledText tt9("chapter12.cpp", "#include \"Graph.h\"\n#include \"Simple_window.h\"\nint main { ... }");
            fixed.put(tt9, 75, 325);

            FramedText ft1("FLTK headers");
            ShadowFrame<FramedText> sfa1(ft1);
            ShadowFrame<ShadowFrame<FramedText> > sfb1(sfa1, 2);
            fixed.put(sfb1, 225, 25);

            FramedText ft2("FLTK code");
            ShadowFrame<FramedText> sfa2(ft2);
            ShadowFrame<ShadowFrame<FramedText> > sfb2(sfa2, 2);
            fixed.put(sfb2, 350, 50);

    // Done, run the application
    window.show_all_children();
    Gtk::Main::run(window);

    return EXIT_SUCCESS;
}