OSDN Git Service

test Add. master
authorMyun2 <myun2@nwhite.info>
Thu, 23 Sep 2010 13:42:16 +0000 (22:42 +0900)
committerMyun2 <myun2@nwhite.info>
Thu, 23 Sep 2010 13:42:16 +0000 (22:42 +0900)
roast_ex/test/js_test/js_test.cpp [new file with mode: 0644]
roast_ex/test/js_test/roast_test_2nc.sln [new file with mode: 0644]
roast_ex/test/js_test/roast_test_2nc.vcproj [new file with mode: 0644]

diff --git a/roast_ex/test/js_test/js_test.cpp b/roast_ex/test/js_test/js_test.cpp
new file mode 100644 (file)
index 0000000..8395bf2
--- /dev/null
@@ -0,0 +1,122 @@
+#include <stdio.h>
+#include <time.h>
+#include "roast/asm/x86/lexical.hpp"
+#include "roast/stream/memory_stream.hpp"
+
+using namespace ::roast;
+using namespace ::roast::lexical;
+using namespace ::roast::assem::x86::lexical;
+
+#define BUF_SIZE       (1024)
+
+int main()
+{
+       unsigned char actual_buf[BUF_SIZE];
+       unsigned char expect_buf[BUF_SIZE];
+       memset(actual_buf,0,sizeof(actual_buf));
+       memset(expect_buf,0,sizeof(expect_buf));
+
+       //      Read Expect (from NASM Binary)
+       FILE *fp_expect = fopen("mov_test", "rb");
+       if ( fp_expect == NULL ){
+               printf("mov_test Open Error!\n");
+               return 1;
+       }
+       size_t expect_length = fread(expect_buf, 1, sizeof(expect_buf), fp_expect);
+       fclose(fp_expect);
+
+       /////////////////////////////////////////////////////////////////////////
+
+       stream::memory_stream actual_strm(actual_buf,sizeof(actual_buf));
+
+       typedef seq<
+               seq<
+                       //      8bit Register to Register
+                       mov<al, bl>,
+                       mov<cl, dl>,
+                       mov<ah, bh>,
+                       mov<ch, dh>,
+
+                       //      16bit Register to Register
+                       mov<ax, bx>,
+                       mov<ax, cx>,
+                       mov<ax, dx>,
+                       mov<bx, ax>,
+                       mov<dx, ax>,
+                       mov<cx, ax>,
+
+                       _true_analyze
+
+               >,
+               //      8/16bit Immediate to Register
+               mov<al, imm8<0x12> >,
+               mov<ah, imm8<0x34> >,
+               mov<ax, imm16<0x1234> >,
+               mov<bx, imm16<0x5678> >,
+
+               //      8/16bit Immediate to Memory
+               mov<byte_ptr16<0x1234>, imm8<0x12> >,
+               mov<word_ptr16<0x1234>, imm16<0x1234> >,
+
+               //      8/16bit Memory to Register
+               mov<bl, byte_ptr16<0x1234> >,
+               mov<al, byte_ptr16<0x5678> >,
+               mov<bx, word_ptr16<0x1234> >,
+               mov<ax, word_ptr16<0x5678> >,
+
+               //      8/16bit Register to Memory
+               mov<byte_ptr16<0x1234>, bl>,
+               mov<byte_ptr16<0x5678>, al>,
+               mov<word_ptr16<0x1234>, bx>,
+               mov<word_ptr16<0x5678>, ax>,
+
+               //      Segument Register
+               mov<es, ax>,
+               mov<es, bx>,
+               mov<cs, ax>,
+               mov<ds, bx>,
+               mov<ax, es>,
+               mov<bx, es>,
+               mov<ax, cs>,
+               mov<bx, ds>,
+
+               _true_analyze
+
+       > actual_t;
+
+       actual_t o;
+       //o.generate(actual_strm, sized_ptr((void*)boot_img,size) );
+       o.generate(actual_strm, actual_strm );
+
+       /////////////////////////////////////////////////////////////////////////
+
+       size_t comp_length = sizeof(actual_buf) - actual_strm.restsize();
+       if ( expect_length > comp_length )
+               comp_length = expect_length;
+
+       for(size_t i=0; i<comp_length; i++)
+       {
+               printf("expect: %02X, actual: %02X ... ", expect_buf[i], actual_buf[i] );
+               if ( expect_buf[i] == actual_buf[i] )
+                       printf("OK.\n");
+               else
+               {
+                       printf("NG!!\n");
+                       printf("%d(0x%X) byte is not Match, compair was not completely...\n", i, i);
+                       return 2;
+               }
+       }
+       printf("%d byte Completely Match!!\n", comp_length);
+       /*
+       //      Compair
+       if ( memcmp(actual_buf, expect_buf, sizeof(expect_buf)) == 0 )
+       {
+               printf("Completely Match!!\n");
+               return 2;
+       }
+       else
+               printf("Not Match...\n");
+       */
+
+       return 0;
+}
diff --git a/roast_ex/test/js_test/roast_test_2nc.sln b/roast_ex/test/js_test/roast_test_2nc.sln
new file mode 100644 (file)
index 0000000..da9ea35
--- /dev/null
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 10.00
+# Visual C++ Express 2008
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "roast_test_2nc", "roast_test_2nc.vcproj", "{75F2DCA9-E904-47A9-A62E-FE8659548B0D}"
+EndProject
+Global
+       GlobalSection(SolutionConfigurationPlatforms) = preSolution
+               Debug|Win32 = Debug|Win32
+               Release|Win32 = Release|Win32
+       EndGlobalSection
+       GlobalSection(ProjectConfigurationPlatforms) = postSolution
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Debug|Win32.ActiveCfg = Debug|Win32
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Debug|Win32.Build.0 = Debug|Win32
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Release|Win32.ActiveCfg = Release|Win32
+               {75F2DCA9-E904-47A9-A62E-FE8659548B0D}.Release|Win32.Build.0 = Release|Win32
+       EndGlobalSection
+       GlobalSection(SolutionProperties) = preSolution
+               HideSolutionNode = FALSE
+       EndGlobalSection
+EndGlobal
diff --git a/roast_ex/test/js_test/roast_test_2nc.vcproj b/roast_ex/test/js_test/roast_test_2nc.vcproj
new file mode 100644 (file)
index 0000000..0cc5c27
--- /dev/null
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="shift_jis"?>
+<VisualStudioProject
+       ProjectType="Visual C++"
+       Version="9.00"
+       Name="roast_test_2nc"
+       ProjectGUID="{75F2DCA9-E904-47A9-A62E-FE8659548B0D}"
+       RootNamespace="roast_test_2nc"
+       Keyword="Win32Proj"
+       TargetFrameworkVersion="196613"
+       >
+       <Platforms>
+               <Platform
+                       Name="Win32"
+               />
+       </Platforms>
+       <ToolFiles>
+               <DefaultToolFile
+                       FileName="masm.rules"
+               />
+       </ToolFiles>
+       <Configurations>
+               <Configuration
+                       Name="Debug|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="1"
+                       CharacterSet="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                       />
+                       <Tool
+                               Name="MASM"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="0"
+                               AdditionalIncludeDirectories="../../include,../../../../_Roast/roast/include"
+                               PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
+                               MinimalRebuild="true"
+                               BasicRuntimeChecks="3"
+                               RuntimeLibrary="3"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               DebugInformationFormat="4"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               LinkIncremental="2"
+                               AdditionalLibraryDirectories=""
+                               GenerateDebugInformation="true"
+                               SubSystem="1"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                       />
+               </Configuration>
+               <Configuration
+                       Name="Release|Win32"
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"
+                       IntermediateDirectory="$(ConfigurationName)"
+                       ConfigurationType="1"
+                       CharacterSet="1"
+                       WholeProgramOptimization="1"
+                       >
+                       <Tool
+                               Name="VCPreBuildEventTool"
+                       />
+                       <Tool
+                               Name="VCCustomBuildTool"
+                               CommandLine="mov_test_nasm.bat"
+                               Outputs="mov_test"
+                       />
+                       <Tool
+                               Name="MASM"
+                       />
+                       <Tool
+                               Name="VCXMLDataGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCWebServiceProxyGeneratorTool"
+                       />
+                       <Tool
+                               Name="VCMIDLTool"
+                       />
+                       <Tool
+                               Name="VCCLCompilerTool"
+                               Optimization="2"
+                               EnableIntrinsicFunctions="true"
+                               AdditionalIncludeDirectories="../../include,../../../../_Roast/roast/include"
+                               PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
+                               RuntimeLibrary="2"
+                               EnableFunctionLevelLinking="true"
+                               UsePrecompiledHeader="0"
+                               WarningLevel="3"
+                               DebugInformationFormat="3"
+                       />
+                       <Tool
+                               Name="VCManagedResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCResourceCompilerTool"
+                       />
+                       <Tool
+                               Name="VCPreLinkEventTool"
+                               CommandLine=""
+                       />
+                       <Tool
+                               Name="VCLinkerTool"
+                               LinkIncremental="1"
+                               AdditionalLibraryDirectories=""
+                               GenerateDebugInformation="true"
+                               SubSystem="1"
+                               OptimizeReferences="2"
+                               EnableCOMDATFolding="2"
+                               TargetMachine="1"
+                       />
+                       <Tool
+                               Name="VCALinkTool"
+                       />
+                       <Tool
+                               Name="VCManifestTool"
+                       />
+                       <Tool
+                               Name="VCXDCMakeTool"
+                       />
+                       <Tool
+                               Name="VCBscMakeTool"
+                       />
+                       <Tool
+                               Name="VCFxCopTool"
+                       />
+                       <Tool
+                               Name="VCAppVerifierTool"
+                       />
+                       <Tool
+                               Name="VCPostBuildEventTool"
+                               CommandLine=""
+                       />
+               </Configuration>
+       </Configurations>
+       <References>
+       </References>
+       <Files>
+               <Filter
+                       Name="\83\\81[\83\83t\83@\83C\83\8b"
+                       Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+                       UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+                       >
+                       <File
+                               RelativePath=".\mov_test.cpp"
+                               >
+                       </File>
+               </Filter>
+               <Filter
+                       Name="\83w\83b\83_\81\83t\83@\83C\83\8b"
+                       Filter="h;hpp;hxx;hm;inl;inc;xsd"
+                       UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+                       >
+               </Filter>
+               <Filter
+                       Name="\83\8a\83\\81[\83\83t\83@\83C\83\8b"
+                       Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+                       UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+                       >
+               </Filter>
+               <File
+                       RelativePath=".\mov_test.asm"
+                       >
+               </File>
+       </Files>
+       <Globals>
+       </Globals>
+</VisualStudioProject>