Comments (3)
This method is private. Should I write a test?
from mipt-mips.
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 ofstd::cin
.
mipt-mips/simulator/modules/core/t/unit_test.cpp
Lines 138 to 144 in 39ba2ab
from mipt-mips.
Now we can study microarchitecture in a much interactive manner! Congratulations!
from mipt-mips.
Related Issues (20)
- Verify correctness of read-after-write behavior
- Make statistic dump better
- Support BSS and SBSS sections in ELF loader
- SLLI/SRLI/SRAI should ignore shamt bits which exceed register size
- External register writes should flush pipeline
- Use const std::array& here
- Fold RISC-V B instruction testing
- Implement ALU as a template class HOT 6
- Add code prefetching algorithms
- Deliver unit tests for JSON output
- assert() is always ignored HOT 1
- RISCV32 Physical memory mapping ? HOT 1
- using noexcept in potentially throwing functions HOT 4
- Wrong "bfp" and "pack" instruction encoding on branch "ooo_window". HOT 2
- Build failing due to specifying template argument in ctor HOT 1
- Build fail: instr_#name not autogenerated HOT 1
- Update rori instruction according to specification HOT 1
- Update bseti instruction according to specification
- Adopt Clang-Format
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mipt-mips.