Analizo

 view release on metacpan or  search on metacpan

t/features/language_support.feature  view on Meta::CPAN

      | csharp   | main        | HelloWorld         |

  Scenario: dependency between specific functions
    Given I am in t/samples/hello_world/<language>
    When I run "analizo graph ."
    Then analizo must report that "<main_function>" depends on "<hello_say>"
    And analizo must report that "<main_function>" depends on "<hello_destroy>"
    Examples:
      | language | main_function         | hello_say                                   | hello_destroy                                   |
      | c        | main::main()          | hello_world::hello_world_say(hello_world *) | hello_world::hello_world_destroy(hello_world *) |
      | cpp      | main::main()          | HelloWorld::say()                           | HelloWorld::destroy()                           |
      | java     | Main::main(String[])  | HelloWorld::say()                           | HelloWorld::destroy()                           |
      | csharp   | main::Main()          | HelloWorld::say()                           | HelloWorld::destroy()                           |

  Scenario: intra-module dependencies
    Given I am in t/samples/hello_world/<language>
    When I run "analizo graph ."
    Then analizo must report that "<hello_say>" depends on "<hello_id>"
    And analizo must report that "<hello_destroy>" depends on "<hello_id>"
    Examples:
      | language | hello_say                                   | hello_destroy                                   | hello_id                      |
      | c        | hello_world::hello_world_say(hello_world *) | hello_world::hello_world_destroy(hello_world *) | hello_world::_hello_world::id |
      | cpp      | HelloWorld::say()                           | HelloWorld::destroy()                           | HelloWorld::_id               |
      | java     | HelloWorld::say()                           | HelloWorld::destroy()                           | HelloWorld::_id               |
      | csharp   | HelloWorld::say()                           | HelloWorld::destroy()                           | HelloWorld::_id               |

  Scenario: some metrics
    Given I am in t/samples/hello_world/<language>
    When I run "analizo metrics ."
    Then analizo must report that the project has total_modules = 2
    And analizo must report that module <main_module> has nom = 1
    And analizo must report that module <hello_world_module> has npm = 3
    And analizo must report that module <hello_world_module> has nom = <total_methods>
    And analizo must report that module <hello_world_module> has npa = <public_attributes>
    Examples:

t/samples/file_with_two_modules/cpp/classes.cc  view on Meta::CPAN

#include "classes.h"

void Class1::say() {
  // don't say nothing, actually
}

void Class2::say() {
  // don't say nothing, actually
}

t/samples/file_with_two_modules/cpp/classes.h  view on Meta::CPAN

#ifndef _CLASSES_H_
#define _CLASSES_H_

class Class1 {
  public:
    void say();
};

class Class2 {
  public:
    void say();
};

#endif // _CLASSES_H_

t/samples/file_with_two_modules/cpp/main.cc  view on Meta::CPAN

#include "classes.h"

int main(int argc, char** argv) {
  Class1 c1;
  Class2 c2;
  c1.say();
  c2.say();
  return 0;
}

t/samples/file_with_two_modules/csharp/Classes.cs  view on Meta::CPAN

namespace classes {

  public class Class1 {
    public void say() {
      // don't say nothing, actually
    }
  }

  public class Class2 {
    public void say() {
      // don't say nothing, actually
    }
  }

}

t/samples/file_with_two_modules/csharp/Program.cs  view on Meta::CPAN

using classes;

public class Program {

  static void Main(string[] args) {
    Class1 c1 = new Class1();
    Class2 c2 = new Class2();
    c1.say();
    c2.say();
  }

}

t/samples/hello_world/cpp/hello_world.cc  view on Meta::CPAN

}

HelloWorld::HelloWorld() {
  this->_id = (HelloWorld::_id_seq++);
}

void HelloWorld::destroy() {
  std::cout << "Goobdye, world! My id is " << this->_id << std::endl;
}

void HelloWorld::say() {
  std::cout << "Hello, world! My id is " << this->_id << std::endl;
}

t/samples/hello_world/cpp/hello_world.h  view on Meta::CPAN

#ifndef _HELLO_WORLD_H_
#define _HELLO_WORLD_H_

class HelloWorld {
  private:
    int _id;
    static int _id_seq;
    void private_method();
  public:
    HelloWorld();
    void say();
    void destroy();
    int public_variable;
};

#endif // _HELLO_WORLD_H_

t/samples/hello_world/cpp/main.cc  view on Meta::CPAN

#include "hello_world.h"

int main() {
  HelloWorld hello1;
  HelloWorld hello2;

  hello1.say();
  hello2.say();

  // even if we don't need to destroy these objects explicitly, we call
  // destroy() to make this similar to the C code
  hello1.destroy();
  hello2.destroy();
  
  return 0;
}

t/samples/hello_world/csharp/HelloWorld.cs  view on Meta::CPAN


public class HelloWorld {
  private static int _id_seq = 0;
  private int _id;
  public static int hello = 1;

  public HelloWorld() {
    this._id = (HelloWorld._id_seq++);
  }

  public void say() {
    Console.WriteLine("Hello, world! My id is " + _id);
  }

  public void destroy() {
    Console.WriteLine("Goobdye, world! My id is " + _id);
  }

  private void private_method() {
    hello = 2;
    Console.WriteLine(hello);

t/samples/hello_world/csharp/main.cs  view on Meta::CPAN

public class main {

  static public void Main() {
    HelloWorld hello1 = new HelloWorld();
    HelloWorld hello2 = new HelloWorld();

    hello1.say();
    hello2.say();

    // // even if we don't need to destroy these objects explicitly, we call
    // // destroy() to make this similar to the C code
    hello1.destroy();
    hello2.destroy();
  }
}

t/samples/hello_world/java/HelloWorld.java  view on Meta::CPAN

  private static int _id_seq = 0;

  private int _id;

  public static int hello = 1;

  public HelloWorld() {
    this._id = (_id_seq++);
  }

  public void say() {
    System.out.println("Hello, world! My is id " + _id);
  }

  public void destroy() {
    System.out.println("Goodbye, world! My id is " + _id);
  }

  private void private_method() {
    hello = 2;
    System.out.println(hello);

t/samples/hello_world/java/Main.java  view on Meta::CPAN

public class Main {
  public static void main(String[] args) {
    HelloWorld hello1 = new HelloWorld();
    HelloWorld hello2 = new HelloWorld();

    hello1.say();
    hello2.say();

    // Yes, I know Java does not need destructors, but I want the program to
    // work just like the C and C++ ones, and I cannot guarantee when (or if)
    // finalize() will be called.
    hello1.destroy();
    hello2.destroy();
  }
}



( run in 1.041 second using v1.01-cache-2.11-cpan-5511b514fd6 )