-
Notifications
You must be signed in to change notification settings - Fork 12
/
App.js
146 lines (138 loc) · 4.74 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/**
* Sample React Native App
*
* adapted from App.js generated by the following command:
*
* react-native init example
*
* https://github.com/facebook/react-native
*/
/* eslint-disable react/no-did-mount-set-state */
import React, {Component} from 'react'
import {StyleSheet, Text, View} from 'react-native'
import misc from './runtimeTests/misc'
import bigNum from './runtimeTests/bigNum'
import int from './runtimeTests/int'
import multiAsset from './runtimeTests/multiAsset'
import linearFee from './runtimeTests/linearFee'
import privateKey from './runtimeTests/privateKey'
import publicKey from './runtimeTests/publicKey'
import bip32Keys from './runtimeTests/bip32Keys'
import address from './runtimeTests/address'
import byronAddress from './runtimeTests/byronAddress'
import crypto from './runtimeTests/crypto'
import ed25519Signature from './runtimeTests/ed25519Signature'
import stakeCredential from './runtimeTests/stakeCredential'
import stakeCertificates from './runtimeTests/stakeCertificates'
import certificate from './runtimeTests/certificate'
import baseAddress from './runtimeTests/baseAddress'
import rewardAddress from './runtimeTests/rewardAddress'
import enterpriseAddress from './runtimeTests/enterpriseAddress'
import transactionInput from './runtimeTests/transactionInput'
import transactionOutput from './runtimeTests/transactionOutput'
import bootstrapWitness from './runtimeTests/bootstrapWitness'
import vkeyWitness from './runtimeTests/vkeyWitness'
import transactionBody from './runtimeTests/transactionBody'
import utils from './runtimeTests/utils'
import transaction from './runtimeTests/transaction'
import transactionBuilder from './runtimeTests/transactionBuilder'
import auxiliaryData from './runtimeTests/auxiliaryData'
import catalyst from './runtimeTests/catalyst'
import emip3 from './runtimeTests/emip3'
import mixedTests from './runtimeTests/mixedTests'
const tests = [
{name: 'misc', testFn: misc},
{name: 'BigNum', testFn: bigNum},
{name: 'Int', testFn: int},
{name: 'MultiAsset', testFn: multiAsset},
{name: 'linearFee', testFn: linearFee},
{name: 'PrivateKey', testFn: privateKey},
{name: 'PublicKey', testFn: publicKey},
{name: 'Bip32*Key', testFn: bip32Keys},
{name: 'Address', testFn: address},
{name: 'ByronAddress', testFn: byronAddress},
{name: 'crypto', testFn: crypto},
{name: 'ed25519Signature', testFn: ed25519Signature},
{name: 'stakeCredential', testFn: stakeCredential},
{name: 'stakeCertificates', testFn: stakeCertificates},
{name: 'certificate', testFn: certificate},
{name: 'baseAddress', testFn: baseAddress},
{name: 'enterpriseAddress', testFn: enterpriseAddress},
{name: 'rewardAddress', testFn: rewardAddress},
{name: 'transactionInput', testFn: transactionInput},
{name: 'transactionOutput', testFn: transactionOutput},
{name: 'bootstrapWitness', testFn: bootstrapWitness},
{name: 'vkeyWitness', testFn: vkeyWitness},
{name: 'transactionBody', testFn: transactionBody},
{name: 'utils', testFn: utils},
{name: 'transaction', testFn: transaction},
{name: 'transactionBuilder', testFn: transactionBuilder},
{name: 'auxiliaryData', testFn: auxiliaryData},
{name: 'catalyst', testFn: catalyst},
{name: 'emip3', testFn: emip3},
{name: 'mixedTests', testFn: mixedTests},
]
let failed = 0
const total = tests.length
let mounted = false
export default class App extends Component<{}> {
state = {
status: 'starting',
failed: 0,
total: tests.length,
}
async componentDidMount() {
if (!mounted) {
for (const test of tests) {
try {
await test.testFn()
console.log(`${test.name} tests completed ✅`)
} catch (e) {
console.log(`${test.name} tests failed ❌`)
console.log(e)
failed++
this.setState({
failed: failed,
})
}
}
console.log(`Failed tests: ${failed}`)
console.log(`Total tests: ${total}`)
this.setState({
status: 'tests finished',
})
console.log('Tests finished')
mounted = true
}
}
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>☆HaskellShelley example☆</Text>
<Text style={styles.instructions}>STATUS: {this.state.status}</Text>
<Text style={styles.instructions}>
Failed tests: {this.state.failed}
</Text>
<Text style={styles.instructions}>Total tests: {total}</Text>
</View>
)
}
}
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
})