Исходный код СУБД RuDB — свободной СУБД с открытым исходным кодом на базе PostgreSQL
rudb
3 days ago bd039d1e92813358c5c5a1e346b49074baf513f2
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
 
import * as React from 'react';
import { Button, SafeAreaView, ScrollView, StyleSheet, Text, View } from 'react-native';
import MNISTTest from './MNISTTest';
import BasicTypesTest from './BasicTypesTest';
import EPContextDataReadTest from './EPContextDataReadTest';
 
type Page = 'home' | 'mnist' | 'basic-types' | 'ep-context-data-read';
 
interface State {
  currentPage: Page;
}
 
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#f5f5f5',
  },
  scrollContent: {
    padding: 20,
    alignItems: 'center',
  },
  title: {
    fontSize: 28,
    fontWeight: 'bold',
    marginTop: 20,
    marginBottom: 10,
    color: '#333',
    textAlign: 'center',
  },
  subtitle: {
    fontSize: 18,
    marginBottom: 30,
    color: '#666',
    textAlign: 'center',
  },
  buttonContainer: {
    width: '100%',
    marginBottom: 30,
    alignItems: 'center',
  },
  buttonWrapper: {
    width: '80%',
    marginBottom: 10,
  },
  description: {
    fontSize: 14,
    color: '#888',
    textAlign: 'center',
    paddingHorizontal: 20,
  },
  header: {
    padding: 10,
    backgroundColor: '#fff',
    borderBottomWidth: 1,
    borderBottomColor: '#ddd',
  },
  testContent: {
    flex: 1,
  },
});
 
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export default class App extends React.PureComponent<{}, State> {
  // eslint-disable-next-line @typescript-eslint/no-empty-object-type
  constructor(props: {} | Readonly<{}>) {
    super(props);
 
    this.state = {
      currentPage: 'home',
    };
  }
 
  navigateTo = (page: Page) => {
    this.setState({ currentPage: page });
  };
 
  renderHome(): React.JSX.Element {
    return (
      <SafeAreaView style={styles.container}>
        <ScrollView contentContainerStyle={styles.scrollContent}>
          <Text style={styles.title}>ONNX Runtime E2E Tests</Text>
          <Text style={styles.subtitle}>Select a test to run:</Text>
 
          <View style={styles.buttonContainer}>
            <View style={styles.buttonWrapper}>
              <Button
                title="MNIST Test"
                onPress={() => this.navigateTo('mnist')}
                accessibilityLabel="mnist-test-button"
              />
            </View>
            <Text style={styles.description}>Test MNIST model with image classification</Text>
          </View>
 
          <View style={styles.buttonContainer}>
            <View style={styles.buttonWrapper}>
              <Button
                title="Basic Types Test"
                onPress={() => this.navigateTo('basic-types')}
                accessibilityLabel="basic-types-test-button"
              />
            </View>
            <Text style={styles.description}>Test various data types with basic models</Text>
          </View>
 
          <View style={styles.buttonContainer}>
            <View style={styles.buttonWrapper}>
              <Button
                title="EPContext Data Read Test"
                onPress={() => this.navigateTo('ep-context-data-read')}
                accessibilityLabel="ep-context-data-read-test-button"
              />
            </View>
            <Text style={styles.description}>Test the epContextDataRead session option and its lifetime</Text>
          </View>
        </ScrollView>
      </SafeAreaView>
    );
  }
 
  renderTestPage(): React.JSX.Element {
    const { currentPage } = this.state;
 
    let testComponent: React.JSX.Element;
    switch (currentPage) {
      case 'mnist':
        testComponent = <MNISTTest />;
        break;
      case 'basic-types':
        testComponent = <BasicTypesTest />;
        break;
      case 'ep-context-data-read':
        testComponent = <EPContextDataReadTest />;
        break;
      default:
        testComponent = <Text>Unknown test</Text>;
    }
 
    return (
      <SafeAreaView style={styles.container}>
        <View style={styles.header}>
          <Button title="← Back to Home" onPress={() => this.navigateTo('home')} accessibilityLabel="back-button" />
        </View>
        <ScrollView style={styles.testContent}>{testComponent}</ScrollView>
      </SafeAreaView>
    );
  }
 
  render(): React.JSX.Element {
    const { currentPage } = this.state;
 
    if (currentPage === 'home') {
      return this.renderHome();
    }
 
    return this.renderTestPage();
  }
}