Beispiel #1
0
        /*
         * private HtmlHighlightedCode.LANGUAGE? _LanguageToHighlight;
         *
         * ///<summary>
         * /// Programming language to highlight
         * ///</summary>
         * public HtmlHighlightedCode.LANGUAGE? LanguageToHighlight
         * {
         * get { return _LanguageToHighlight; }
         * set
         * {
         *    if (_LanguageToHighlight != value)
         *    {
         *        if (_LanguageToHighlight != null)
         *        {
         *            ReleaseFileResources();
         *        }
         *        _LanguageToHighlight = value;
         *        if (value != null)
         *        {
         *            RemoveError(LANG_IS_NULL_ERROR);
         *            GetFileResources();
         *        }
         *    }
         *    ReValidate();
         * }
         * }
         *
         * private const string HIGHLIGHT_JS_FILENAME = "highlight.js",
         *                   SAMPLE_CSS_FILENAME = "sample.css",
         *                   HIGHLIGHT_DIRECTORY = "HighlightLanguages", LANG_IS_NULL_ERROR = "'Language' property must be specified";
         */

        public override string GetScoTestInitializer()
        {
            string input  = "[";
            string output = "[";

            for (int i = 0; i < TestCases.Count; ++i)
            {
                CompiledTestCase item = TestCases[i];
                input  += "'" + item.Input.Replace("\\", "\\\\").Replace("'", "\\'") + "'";
                output += "'" + item.Output.Replace("\\", "\\\\").Replace("'", "\\'") + "'";

                if (i != TestCases.Count - 1)
                {
                    input  += ",";
                    output += ",";
                }
            }
            input  += "]";
            output += "]";

            string result = string.Format("new compiledTest('TextBoxBefore', 'TextBoxAfter', 'TextBoxUserCode', '{0}', '{1}', {2}, {3}, {4}, /*BEG*/{5}/*END*/, {6}",
                                          ServiceAddress, CompiledQuestion.GetLanguageString(Language), TimeLimit, MemoryLimit, input, output, this.Rank.ToString());


            result += ")";

            return(result);
        }
Beispiel #2
0
        /*
         * private HtmlHighlightedCode.LANGUAGE? _LanguageToHighlight;
         *
         * ///<summary>
         * /// Programming language to highlight
         * ///</summary>
         * public HtmlHighlightedCode.LANGUAGE? LanguageToHighlight
         * {
         * get { return _LanguageToHighlight; }
         * set
         * {
         *    if (_LanguageToHighlight != value)
         *    {
         *        if (_LanguageToHighlight != null)
         *        {
         *            ReleaseFileResources();
         *        }
         *        _LanguageToHighlight = value;
         *        if (value != null)
         *        {
         *            RemoveError(LANG_IS_NULL_ERROR);
         *            GetFileResources();
         *        }
         *    }
         *    ReValidate();
         * }
         * }
         *
         * private const string HIGHLIGHT_JS_FILENAME = "highlight.js",
         *                   SAMPLE_CSS_FILENAME = "sample.css",
         *                   HIGHLIGHT_DIRECTORY = "HighlightLanguages", LANG_IS_NULL_ERROR = "'Language' property must be specified";
         */

        public override string GetScoTestInitializer()
        {
            string input  = "[";
            string output = "[";

            for (int i = 0; i < TestCases.Count; ++i)
            {
                CompiledTestCase item = TestCases[i];
                input  += item.Input;
                output += item.Output;

                if (i != TestCases.Count - 1)
                {
                    input  += ",";
                    output += ",";
                }
            }
            input  += "]";
            output += "]";

            string result = string.Format("new compiledTest('TextBoxBefore', 'TextBoxAfter', 'TextBoxUserCode', '{0}', '{1}', {2}, {3}, {4}, {5}",
                                          ServiceAddress, CompiledQuestion.GetLanguageString(Language), TimeLimit, MemoryLimit, input, output);


            result += ")";

            return(result);
        }