当前位置:网站首页>d named unit test
d named unit test
2022-08-06 10:53:00 【fqbqrr】
Usually independent单元测试上工作,因为速度和less output,只想运行一个.And usually there are several in the file单元测试.急需要命名单元测试.
只需要,version(newFeature) unittest {}.
#! /usr/bin/env dub
/++ dub.sdl:
dflags "-preview=shortenedMethods"
configuration "release" {
targetType "executable"
}
configuration "unittest" {
targetType "library"
dependency "silly" version="~>1.1.1"
}
+/
int factorial(int n) => n <= 1 ? 1 : n * factorial(n - 1);
@("!5") unittest {
assert(factorial(5) == 120);
}
@("!0 and !1") unittest {
assert(factorial(0) == 1);
assert(factorial(1) == 1);
}
version (unittest) {
} else {
void main(string[] args) {
import std.conv : to;
import std.stdio : writeln;
writeln(args[1].to!int.factorial);
}
}
//用法:
$ ./fact.d 10
3628800
$ dub -q test --single fact.d
? fact !5
? fact !0 and !1
Summary: 2 passed, 0 failed in 0 ms
边栏推荐
- HCIP Day 14 Notes
- 联系题作业
- 端侧GPU基于opencl实现reduce算子
- 使用 husky+commitlint 检查提交描述是否符合规范要求,及提交代码进行格式化
- WebRTC Directory Structure
- [Software Test Written Questions] Alibaba (China) Network Technology Co., Ltd.
- ICDE‘22推荐系统论文梳理之Industry篇
- Su Qiugui: Why do foreign trade companies need to do Google subdivision deployment
- P1747 好奇怪的游戏
- PAT甲级打卡-1005-1010
猜你喜欢

i.MX6ULL配置GPIO一共需要几步?

浏览器的缓存机制 强制缓存 && 协商缓存

NetEase Cloud Media Center for Audio and Video Capabilities, Focusing on the Digital Transformation of the Banking Industry

vant组件 van-dropdown-menu 在小程序中覆盖了列表页,导致bindtap点击事件时不时失效

腾讯35k出来的,他让我见识到什么叫“精通MySQL调优”

跨链桥已成行业最大安全隐患,为什么和怎么办

Mini Program Commodity List: Commodity Collection Implementation

自己动手写数据库:并发管理的基本原理

2个Kubernetes使用同一个Ceph存储达到Kubernetes间持久化数据迁移

小程序商品列表:商品收藏实现
随机推荐
Kubernetes PV在Retain策略Released状态下重新分配到PVC恢复数据
SkiaSharp 之 WPF 自绘 粒子花园(案例版)
Notion 中文:客户端、网页端汉化方案
《Jenkins 2.x实践指南》读书笔记-环境变量与构建工具
kubeadm安装的Kubernetes etcd备份恢复
kubernetes上部署rook-ceph存储系统
Do-it-yourself databases: Fundamentals of concurrency management
Outdoor power bank: Huabao Xinneng, EcoFlow staged "Dragon Tiger Fight"
SQLNET.ORA中SQLNET.ALLOWED_LOGON_VERSION参数介绍
腾讯35k出来的,他让我见识到什么叫“精通MySQL调优”
【剑指offer】BM4 合并两个排序的链表(js实现)
Kubernetes微服务框架
WebRTC Directory Structure
Kubernetes+Ceph时cephfs和ceph-rbd的PV管理
HCIP——VLAN实验
在线音乐播放项目——BY音乐
《Jenkins 2.x实践指南》读书笔记-Jenkins 2.x pipeline语法
Unity super simple object pool
vant组件 van-dropdown-menu 在小程序中覆盖了列表页,导致bindtap点击事件时不时失效
太强了,一个注解搞定接口返回数据脱敏!