TrueChain development preparation articles - tune test code, perform unit test

2023-11-08

Original link

TrueChain development environment, currently supports Windows, MacOS, Linux.
This section describes how to perform unit tests.


Run go test -v to run the test code


1. Introduction

Execute the following command, it will automatically check the test module and code in the current directory, and automatically load the execution. It is also the main command we use to test the code and perform unit tests.

go test
2. Running unit test

In the tests directory of TrueChain’s truechain-engineering-code project, there are mainly the following test files:

  • block_test.go
  • block_test_util.go
  • difficulty_test.go
  • difficulty_test_util.go
  • init_test.go
  • rlp_test.go
  • rlp_test_util.go
  • state_test.go
  • state_test_util.go
  • transaction_test.go
  • transaction_test_util.go
  • vm_test.go
  • vm_test_util.go

Beginners can enter the project as soon as possible by learning the test code.

Specific implementation steps

Run the following command and switch to the tests directory:

cd tests

And then run the following command:

go test -v

Running result
The results of the full pass test are as follows:

--- PASS: TestTransaction (0.00s)
--- PASS: TestBlockchain (0.00s)
--- PASS: TestRLP (0.00s)
--- PASS: TestVM (0.00s)
--- PASS: TestState (0.00s)
--- PASS: TestDifficulty (0.00s)
PASS
ok      github.com/truechain/truechain-engineering-code/tests   0.107s

It indicates that all five test modules passed the test.

Common problems and processing method

  1. If you find that some of the pacakge is not complete, you can run the go get [pacakage] command to get the specified pacakge.
  2. If you find an error gcc compiler error problem, “Window environment to build,” according to the documentation section check for correct installation MinGW.
  3. If you find that you can’t find the file error, like “can’t find test files in testdata\TransactionTests, did you clone the tests submodule?”, you can follow the error prompt, first create the testdata directory in the tests directory, then in the testdata directory. The problem can be solved by creating the corresponding TransactionTests directory. Run go test -v again. Check the results of the run until all passes the test.

Supplement

In view of the different development environment and configuration of each person, you may encounter other problems that cannot pass the go test. It is recommended that you use the search more and try to solve it yourself. If you still have problems, you can mention the issue.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

TrueChain development preparation articles - tune test code, perform unit test 的相关文章

  • Oracle中group by用法

    Oracle中group by用法 在select 语句中可以使用group by 子句将行划分成较小的组 一旦使用分组后select操作的对象变为各个分组后的数据 使用聚组函数返回的是每一个组的汇总信息 使用having子句 限制返回的结

随机推荐

  • sql用于判断的函数decode\case when then else语法

    简单的判断可以用decode函数 例如 如果字段a是null 值为0 如果是 值也为0 否则就是a的值 select decode a null 0 0 a from table 当需要有多个条件并列的时候 用case when then
  • 物联网技术和计算机网络技术,物联网技术下计算机网络技术专业建设探讨

    摘 要 物联网应用领域的高速扩张为高校人才培养带来新的机遇和挑战 本文论述了计算机网络技术专业开设物联网方向的必要性和可行性 研究结合学院行业资源及优势专业培养网络技术专业人才的新思路 提出融合多专业的以智慧交通 智慧物流等物联网应用为特色
  • springboot 微信小程序支付

    简单对支付封装 使用到maven 依赖 版本依照自己项目情况自行添加
  • 惠普136nw打印机清零_HP打印机清零方法(冷复位恢复出厂设置)

    一体机的 冷复位 可以将一体机内部的程序恢复到出厂时的设置 通过此操作 可以解决以下问题 随机驱动程序版本高于 V6 0 以后的一体机 连接电脑时可以通过软件查看墨水余量 这部 分一体机如果执行冷复位 会将墨水信息清除 这时将 无法识别该墨
  • 过TP保护与解除游戏驱动保护

    名称 Nakd KiAttachProcess 功能 My RecoveryHook KiAttachProcess的中继函数 参数 返回 static NAKED VOID Nakd KiAttachProcess asm mov edi
  • (9.1.1)线性代数之行列式

    1 行列式的基本公式 2 行列式的基本性质 3 行列式的求值 4 克拉默法则求解方程组 5 典型例题 1 行列式的基本公式 公式1 公式2 公式3 2 行列式的基本性质 性质1 行列式与它的转置行列式相等 性质2 互换行列式的两行 列 行列
  • Python爬虫详解

    初识爬虫 爬虫的概念 什么是爬虫 爬虫 通过编写程序 模拟浏览器上网 并抓取有价值的数据的过程 反爬虫 门户网站通过制定相应的策略或技术手段 来阻止爬虫程序对其网站数据的爬取 反反爬 爬虫程序可以采用一些技术手段 来绕过或破坏门户网站的反爬
  • JPA JPQL语句 高级分页查询

    JPA 04 JPQL JPQL 掌握 1 什么是JPQL JPQL全称Java Persistence Query Language ava持久化查询语言 JPQL 是一种可移植的查询语言 旨在以面向对象表达式语言的表达式 jpql和sq
  • 多态中虚函数同名参数不同

    案例 class A public A virtual A virtual void says int x int y void A says int x int y std cout lt lt A n class B public A
  • 时序预测

    时序预测 MATLAB实现MLP多层感知机时间序列预测 目录 时序预测 MATLAB实现MLP多层感知机时间序列预测 预测效果 基本介绍 模型特性 程序设计 学习总结 预测效果 基本介绍
  • ABP学习资源整理

    不同的编程语言都有构建Web Application的框架 比如C 中的ASP NET Core和ABP Java中的Spring Boot和Spring Cloud Python中的Django和Flask Node js中的Expres
  • 使用Gitlab一键安装包后的日常备份恢复与迁移

    Gitlab 创建备份 使用Gitlab一键安装包安装Gitlab非常简单 同样的备份恢复与迁移也非常简单 使用一条命令即可创建完整的Gitlab备份 gitlab rake gitlab backup create 使用以上命令会在 va
  • openssh升级报错configure: error: Your OpenSSL headers do not match your library. Check config.log for d

    整体的报错是这样的 checking OpenSSL library version 1010104f OpenSSL 1 1 1d 10 Sep 2019 checking whether OpenSSL s headers match
  • 挖洞思路:前端源码泄露漏洞并用source map文件还原

    0x01漏洞简介 webpack是一个JavaScript应用程序的静态资源打包器 module bundler 它会递归构建一个依赖关系图 dependency graph 其中包含应用程序需要的每个模块 然后将所有这些模块打包成一个或多
  • 关于CSS样式的层叠顺序

    CSS支持给同一元素多次设置相同的规则 这就是所谓竞争规则 浏览器会使用层叠顺序来确定一组竞争规则中生效的规则 例如 浏览器给每个元素设置默认规则 当我们给一个元素设置规则时 它会与默认规则竞争 但由于有较高的层叠顺序 所以我们设置的规则会
  • java中讲讲DataOutputStream的用法,举例?

    1 4 DataOutputStream的用法 马克 to win 一定要注意DataOutputStream 与DataInputStream必须配合使用 以便将基本数据类型 int char long String等 写入一个数据流 详
  • python构建深度神经网络(DNN)

    本文学习Neural Networks and Deep Learning 在线免费书籍 http neuralnetworksanddeeplearning com index html 用python构建神经网络识别手写体的一个总结 代
  • 深入理解数据结构——数组、矩阵

    include
  • Go实战学习笔记-1.2基础语法:变量、常量、包、指针等

    1 前言 这里总结一下Go中变量 常量 包 函数 指针 输入输出及基础数据类型转换的基础用法 便于回顾 本次总结的内容大致如下 2 变量variables 变量声明以及可代表的类型很多 var是变量声明的关键字 但也可以使用 进行短声明 如
  • TrueChain development preparation articles - tune test code, perform unit test

    Original link TrueChain development environment currently supports Windows MacOS Linux This section describes how to per