Giter Club home page Giter Club logo

Comments (3)

exucutional avatar exucutional commented on June 2, 2024

This method is private. Should I write a test?

from mipt-mips.

pavelkryukov avatar pavelkryukov commented on June 2, 2024

You must, but you cannot write a test for private method.

First of all, you should write a test that fails because of the wrong behavior. ("red stage")
Then, you fix the code so test passes and other tests are not affected. ("green stage").
Finally, you refactor and optimize code ("refactor stage").

For more details on TDD, please follow our Wiki page: https://github.com/MIPT-ILab/mipt-mips/wiki/Introduction-to-Test-Driven-Development. It's not the best manual, but you may look for lots of resources over the Internet.

For testing, there can be two approaches:

  • Difficult one. You write unit tests for Writeback module from scratch: writing some instructions to input ports, reading the expected output from the output ports. It goes far beyond that issue, we even need a dedicated tracker.
  • Simple one (I suggest going here). We test PerfSim as a whole system. The idea is to provide a binary input and a keyboard input which cause a error. I assume the binary input has no problem for you as it is used already (see code below), keyboard input is not so hard as well, since you may use std::istringstream as a parameter to MARSKernel class instead of std::cin.

TEST_CASE( "Torture_Test: Perf_Sim, RISC-V 32 simple trace")
{
std::ostream nullout( nullptr);
auto sim = create_mars_sim( "riscv32", TEST_PATH "/rv32ui-p-simple", nullout, false);
CHECK( sim->run_no_limit() == Trap::HALT);
CHECK( sim->get_exit_code() == 0);
}

from mipt-mips.

pavelkryukov avatar pavelkryukov commented on June 2, 2024

Now we can study microarchitecture in a much interactive manner! Congratulations!

from mipt-mips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.